Skip to main content

Full text of "Micro 6502 Journal Issue 55"

See other formats


NO. 55 



DECEMBER 1982 



t 



— - »/IA r.- 



150 

;.95 
^.00 




THE 6502/6809 JOURNAL 




Commodore Feature 



ATARI Graphics 



APPLESOFT GOTO/GOSUB Checker 



68000 Logic Instructions 



\w. 



Mii^filf riir 



The Visual Difference 




KCffl« 
SMS 
SFJU 



ajOTtlOOOESStWI 
OSIDFSSia 
TOCHT 
OMB COST (F 54LES 



MCa 2223.Q 



WTO SBIS 

am laar 






VfSiCalc'' 



You Won't Need VfslCalc™ To See Your Savii 



^y\AGlCALC is the second generation of sp^ 
provides you with a!! the power you neec 
^hardware ("'^'^■^'^th roughs— without your he 

'aAAGICALv- iHuudes: 

• 70-columii upper- and lower-case video 
display 

• Full 80-coiumn board display 
■ 40K:olunin standard display 

• Individual column widths 



• Full comp "*■'"''**■ 

• Hard-disk w, > 

• Special offer "'- 

• Ma^ic editing 



;AAAGICALC-An outstanding product 

$|49?5 



(ce 




Breakthrough to today's technology by contacting: ^^^ 

MM 

5547 sotsumo avenue • north holluwood, coHfornio 916 01 *. £13/ 985-2922 ClriSCI, 



.-. ~ Mt,Mi* f lt^0ltlfiiA%MwXltUiOfyt 



sJCalc is a registered trademark of VisiCorp. A/^GICALC is a trademark of Artsci, inc. 





FLEX - OS-9 LEVEL ONE - UNIFLEX - OS-9 LEVEL TWO 

ONLY GIMIX Systems can be configured to run any of these. 



GIMIX systems utilize tlie most powerful 6809 operating systems: FLEX, UniFLEX, OS-9 LEVEL ONE and TWO -- the systems 
the PROS use. This means a wide selection of software to choose from as well the ability to develop sophisticated, multi- 
user/multi-tasking programs on your GIMIX System, 

TnG GIMIX CLASSY CHASSIS consists of a heavy-weight aluminum mainframe 
--'"*■ '-~~ — --— J^ cabinet which provides more than ample protection for the electronics and 1 or 2 optional 

5Va" drives. 
I ^^^^ ~JRH^HI^|H||H Backpanel connectors can be added for convenient connection of terminals, printers. 

.1 ^KI^^'hl^F^sll -■■*"■"" t^A drives and other peripherals. 

A 3 position locking keyswitch enables users to disable the front panel reset button to pre- 
vent accidental or unauthorized tampering with the system. 

The GIMIX system mother board provides fifteen 50 pin slots and eight 30 pin I/O slots -- 
the most room for expansion of any SS50 system available. The on board baud rate 
generator features 1 1 standard baud rates, 75 to 38. 4K, for maximum versatility and compatibility with other systems. Extend- 
ed address decoding allows the I/O block to be addressed anywhere in the 1 megabyte address space. All components feature 
Gold plated connectors for a lifetime of solid connections. All boards are fully buffered for maximum system expansion. 

Each GIMIX Mainframe System is equipped with an industrial quality power supply featuring a ferro-resonant constant 
voltage transformer to insure against problems caused by adverse power input conditions such as A.C. line voltage fluctua- 
tions etc. The supply provides 8 volts at 30 amps and plus or minus 16 volts at 5 amps, more than enough capacity to power a 
fully loaded system and two internal drives. 

The 2MHZ GIMIX 6809 PLUS CPU board includes a time of day clock with battery back-up and 6840 pro- 
grammable timer to provide the programmer with convenient, accurate time reference. Later addition of 9511 or 9512 
arithmetic processors is provided for on the board. The unique GIMIX design enables software selection of either OS-9 or 
FLEX, both included in many complete GIMIX systems. 

GIMIX STATIC RAM boards require no complicated refresh timing cycles or clocks for data retention. 
GIMIX memory boards are guaranteed for 2 MHz operation with no wait state or clock stretching required. 

Our low power NMOS RAM requires less than 3/4 amp at 8V for a fully populated 64K board. For critical situations, our non- 
volatile 64K byte CMOS static RAM boards with built in battery back-up retain data even with system power removed. A fully 
charged battery will power this board for a minimum of 21 days. A write protect switch permits CMOS boards to be used for 
PROM/ROM emulation and software debugging. 

Tn© GIMIX DMA COntrOllGr leaves the processor free to perform other tasks during disk transfers - an impor- 
tant feature for multi-user/multi-tasking systems where processor time allocation is critical. The DMA board will accomodate 
up to 4 drives 5Vi" or 8" in any combination running single or double density single or double headed. Programmed I/O Disk 
Controllers are also available. 

GIMIX SySTGmS are designed with ultimate RELIABILITY in mind. You can choose from the below featured systems or 

select from our wide variety of components to build a custom package to suit your needs. 

GIMIX 2MHz 6809 System including; CLASSY CHASSIS, 6809 PLUS CPU BOARD, 56KB STATIC RAM, 2 SERIAL PORTS 

W/CABLES, GMXBUG MONITOR, FLEX, and OS-9 LEVEL 1 $3248.49 

FOR TWO 5 'A "40 TRACK DSDD DRIVES ADD $ 900.00 

GIMIX 128KB WINCHESTER SYSTEM including: CLASSY CHASSIS, 6809 PLUS CPU BOARD, 128KB STATIC RAM, 4 SERIAL 
PORTS W/CABLES, 5 V4" 80 TRACK DSDD FLOPPY DISK DRIVE, 19MB 5 V4" WINCHESTER HARD DISK, 039 LEVEL 2, EDITOR 

AND ASSEMBLER $8998.09 

50HZ Versions Available, 8" Drives Available — Contact GIMIX for Prices and Information. 

The Sun Never Sets On A GIMIX! 

GIMIX users are found on every continent, including Antarctica. A representative group of GIMIX users 

includes: Govemment Research and Scientific Organizations in Australia, Canada, U.K. and in the U.S.; ,\, 

NASA, Oak Ridge, White Plains, Fermilab, Argonne, Scripps, Sloan Kettering, Los Alamos National Labs, ji '*• 

AURA. Universities: Carleton, Waterloo, Royal Military College, in Canada; Trier in Germany; and in the ^ 

U.S.; Stanford, SUNY, Harvard, UCSD, Mississippi, Georgia Tech. Industrial users in Hong Kong, ^;- / 

Malaysia, South Africa, Germany, Sweden, and in the U.S.; GTE, Becton Dickinson, American Hoechst, v 

Monsanto, Allied, Honeywell, Perkin Elmer, Johnson Controls, Associated Press, Aydin, Newkirk Electric, 

Revere Sugar, HI-G/AMS Controls, Chevron. Computer mainframe and peripheral manufacturers, IBM, 

OKI, Computer Peripherals Inc., Qume, Floating Point Systems. Software houses; Microware, T.S.C., I '4- 

Lucidata, Norpak, Talbot, Stylo Systems, AAA, HHH, Frank Hogg Labs, Epstein Associates, Softwest, 

Dynasoft, Research Resources U.K.. Microworks. Meta Lab. Computerized Business Systems. 

GIMIX Inc. reserves the right to change pricing and product H B B^B^B B ^9^^ \f~\(~' 

speeciflcatlons at any time without further notice. 1337 WEST 37th PLACE ^^^9ll I II .^P^^ 

CHICAGO, ILLINOIS 60609 SB^IH I I I H^F ^^ 
GIMIX" and GHOST" are registered trademarks of GIMIX Inc. ,^I^^ ^^-, r-r- .^ -r^ ^ ... . ^ .• 

FLEX and UniFLEX are trademarks of Technical Systems Consultants Inc (312) 927-5510 The Company 1/ial delivers 

OS-9 is a trademark of Microware Inc. TWX 910-221-4055 Qualily Electronic products sirtce 1975. 

© 1982 GIMIX Inc. 




No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



1 



ANNOUNCiriG 



ElecfroScreen" 



kiiii. 



$595 



the Superior Alternative .r^^. 

to the Traditional Alphanumeric Terminals 




The ElectroScreen " intelligent Graphics Board Features: 



Graphics 

• 512 X 480 resolution bit-mapped display 

• Interleaved memory access — fast, snow-free updates 

Intelligence 

• 6809 on-board mpu 

• 6K on-board firmware 

• STD syntax high level graphics command set 

• Removes host graphics software burden 

• Flexible text and graphics integration 

• Multiple character sizes 

• User programs can be run on-board 



Terminal 

• Terminal emulation on power-up 

• 83 characters by 48 lines display 

• Easy switching among user-defined character sets 

• Fast hardware scrolling 

Additional Features 

• SS-50C and SS-64 compatible board 

• Board communicates with host through parallel latches 

• Composite and TTL level video output 

• 8 channel 8 bit A/D converter 

• Board occupies 4 address bytes 



See your dealer today! 
The ElectroScreen manual Is available for $10, credited toward purchase of the board. 



The ElectroScreen has a 90 day 
warranty from purchase date. 

Dealers, please contact us tor our 
special introductory package. 




PrivaclnCi 



(703)671-3900 

3711 S. George Mason Dr., Falls Church, Va. 22041 



MICRO - The 6.502/6809 Journal 



No. 55 - December 1982 



/MCDO 



December Highlights 



Commodore Machines Featured 

This month we cover the full range of Commodore's 
machines: the PET, VIC, SuperPET, and the exciting new 
Commodore 64. Each machine has its own distinct 
features, but also shares characteristics with the other 
Commodore family members. CBM users will want to 
read all the Commodore related articles in this issue. 

The second part of the University of Rochester's series 
(p. 59) discusses the use of an inexpensive device, the 
analog transducer, which can be applied to many problems 
outside the college teaching laboratory. The analog 
transducer makes it possible for your digital computer to 
deal with quantities measured on a continuous scale — 
light, voltages, densities. 

Contributing Editor Jim Strasma starts on a six-part 
series (p. 37) that will help you write better program 
packages. In particular, it will cover CBM's powerful, yet 
poorly understood, relative record system. The first part, 
however, deals with designing a modular program package, 
setting things up, and passing parameters. Jim uses por- 
tions of the public domain program "Bennett's Mail List 
4040" to illustrate his points. 

We also offer a number of utilities for Commodore 
machines. Hans Hoogstraat's "BASIC Squeeze for PET" 
(p. 42) is a cassette buffer-sized program that can be saved 
with a fully expanded and commented BASIC program. 
When the program is run, it makes a call to the squeeze 
routine, which compresses the program to take less space 
and run faster. Troup and Strasma's "SOUP" (p. 52) is a 
compare program for machine-language routines saved on 
disk. Thomas Henry's "BASIC Line Delete for PET and 
VIC" [p. 47) adds the capability of deleting more than one 
BASIC program line at a time. 

In our "Short Subjects" section (p. 97) we have two 
items of interest to users of Commodore machines. Terry 
Peterson explains the ASCII character set on the SuperPET 
and reveals some hidden features. "VIC Jitter Fixer," by 
Contributing Editor Dave Malmberg, can be added to your 
paddle, joystick, and light-pen programs to give you more 
reliable readings from these devices. 

Finally, we feature the new Commodore 64 computer 
in both "PET Vet" and on our data sheet. Loren Wright's 
column [p. 54) reviews the graphic capabilities of this 
exciting new computer, and the data sheep (p. 109) pro- 
vides a memory map, interfacing information, and lists of 
graphics and sound registers. 



Expand Your Computer's Capabilities 
with New Hardware 

The BSR X-10 allows you to control remotely a wide 
vjuriety of electrical devices in your home. There are two 
versions available; one sends its signals using power lines 
as antennas, and another uses ultrasonic signals. Each 
light or appliance is cotmected to its own receiver module. 
John Krout's "Home Control Interface for CIP" (p. 11] 
shows how to add ultrasonic circuitry to your computer at 
a cost much less than the BSR ultrasonic option. David 
Hayes's "Atari Meets the BSR X-10" (p. 82) shows how to 
convert the imit for control from Atari's controller ports. 

If you've ever looked at a 6502 programming manual, 
you might have noticed all the unused op codes. Now you 
can use those codes to execute your own machine-language 
routines. Curt Nelson and his associates ("Utilizing 
6502's Undefined Operations," p. 93) present a circuit 
that causes the 6502 to execute your code, instead of 
crashing, when it encounters an unused op code. 

In "Programmable Character Generator for OSI" Colin 
Macauley demonstrates how to define your own 
characters (p. 88). OSI readers .shuld turn to our OSI book 
announcement on page 25. 

Joe Hootman's in-depth coverage of the 68000' s in- 
struction set continues (p. 851 with a discussion of the 
logic instructions. As usual, convenient reference tables 
are included. 

Apple and Atari 

Paul Swanson concludes his three-part series on Atari's 
character graphics (p. 22] with a demonstration of patch- 
ing into Atari's vertical blank interrupt routine. His 
"From Here to Atari" column (p. 32) covers a variety of 
topics, including Atari's new software acquisition centers 
and some technical tidbits. 

Peter Meyer presents an "Applesoft GOTO/GOSUB 
Checking Routine" (p. 26) that displays all incorrect 
GOTO and GOSUB references. "ILISZT for Integer 
BASIC," by Leonard Anderson, is a follow up to a similar 
program he presented for Applesoft (p. 13). It produces an 
attractive, formatted listing of your Integer BASIC pro- 
gram, complete with indentation, paging, and other fancy 
features. Tim Osbom's "Apple Slices" [p. 65) presents a 
general-purpose binary search routine that can be called 
using the & vector. 

JMCRO 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



#,FOR YOUR APPLE II 
Industry standard products at super saver discount prices 




PARALLEL PRINTERS 
NEC 8023 or C-ITOH 8510 

(Virtually identical) Specifications; • 100 CPS dot 
matrix printer • 80 column print- 136 characters 
per line • Tractor/friction feed • 7 different print 
fonts included • 2K printer buffer • Proportional 
spacing • Bit image graptiics and graptiic symbols. 

NEC 8023 or C-ITOH $495 

NEC 8023 or C-ITOH 8510 with 

Parallel Interface and Cable $550 

EPSON 100 with Parallel Interface 

and Cable $749 



Z-80 CARD FOR YOUR APPLE 
MICROSOR SORCARD 

WitfiCP/M-andMBASIC. 

(List: $399) $289 

--..tw Best Buy! a 
4BgL ADVANCED LOGIC SYSTEM 
^PF^ Z-CARD WithC-PM- 

Has everytfiing ttie Softcard has except MBASIC. 
Works Witt) Microsoft's disks too. 

j|||U. (List $269) Special at $195 

iEpP' ALS SYNERGIZER 

CP/M' operating package witti an 80 column 
video board, CP/M" interface, and 16K memory 
expansion for Apple II. Permits use of ttie full 
range of CP/M" software on Apple II. Includes 
SuperCALC. 

(List: $749) $549 

<lftk U-Z-80 PROCESSOR BOARD 
^^PifF^ (From Europe) 

Software compatible witt) Softcard and 

ALS Software $149 

MICROSOFT -t- PREMIUM SYSTEM 

Includes Videx Videoterm, Softswitcli, Microsoft 
and Softcard, Microsoft and Z-80 Card, and 
Osborn CP/M" Manual 5595 



•» \ JOYSTICK 

• * ....mmi. Takes ttie place of two 
Apple Paddle Controllers. 

From BMP Enterprises. Heavy duty industrial con- 
struction and cable. Non-self centering. Witti 
polarity switches for consistent motion control. 

(List: $59) $39 

MONITORS FOR YOUR APPLE 

AMOEK300G 

(18MHZ Anti-Glare Screen) $179 

NEC 12" HIRES GREEN $179 

SUPER SPECIAL! 
SPECIAL 12" GREEN MONITOR $99 




SPECIAL AND NEW 

5 MEGABYTE HARD DISK 

For Apple II. Supplied with controller Use with 
CP/M, Apple DOS, & Apple Pascal $1995 

5V4" DISK DRIVE 
Use with standard Apple II disk controller .$295 

51/4" FLOPPY DISKS 

With hub rings. Box of 10. 

With other purchase $19.95 

Without purchase $23.00 

16K MEMORY EXPANSION MODULE 

The preferred 16K RAM Expansion Module from 
PROMETHEUS. Fully compatible with CP/M" and 
Apple Pascal". With full 1-year parts and labor 
warranty. (List: $169) $75 

WORD PROCESSING SPECIAL 
WITH WORDSTAR AND SUPERCALC! 

Do professional word processing on your APPLE. 
All necessary hardware and software included. 
Complete 80 column video display, enhanced 
character set, 16K memory board, Z-Card with 
CP/M" software, Wordstar and word processing 
software and SuperCALC. 
^^^^^ (List: $1 ,128) . . . .Special at $695 

^PfF'/rD/n Pmmelheus! Expa nda R AM 

The only 128K RAM card that lets you start with 
16K, 32K, or 64K of memory now and expand to 
the full 128K later Fully compatible with Apple 
Pascal, CP/M", and Visacalc. No Apple modifi- 
cation required. Memory management system in- 
cluded with all ExpandaRAMs. Disk emulators 
included with 64K and 1 28K versions. 

MEM-32 Two rows of 16K RAMS 

make a 32K RAM Card $209 

MEM-64 One row of 64K RAM. 

With DOS 3.3 disk emulator $299 

MEM-128 Two rows of 64K RAMS installed 

makea128KCard. 

With DOS 3.3 disk emulator $399 

MEM-RKT 64K RAM Add-On-Kits- 

64K Dynamic RAMS. Each $125 

VISICALC Expansion Program 

for MEM-128 $75 

MEM-PSL Pascal disk emulator for 

MEM-128 $45 

MODEMS FOR YOUR APPLE II 

HAYES Smartmodem $229 

MICROMODEM II $279 




VERSAcard FROM PROMETHEUS 

Four cards on one! With true simultaneous opera- 
tion. Includes: (1) Serial Input/Output Interface, 
(2) Parallel Output Interface, (3) Precision Clock/ 
Calendar, and (4) BSR Control. All on one card. 
Fully compatible with CP/M" and Apple Pascal". 

(List: $249) $169 




80 COLUMN 

VIDEO DISPLAYS 

FOR APPLE II 

SMARTERM 

(Not to be confused with SUPRTERM) 

Software switching from 80 to 40 and 40 to 80 
characters. 9 new characters not found on the 
Apple keyboard. Fully compatible with CP/M" and 
Apple PASCAL". With lowest power consumption 
of only 2.5 watts. 

(List: $345) $225 

SMARTERM EXPANDED CHARACTER SR 

7" X 11" matrix with true decenders Add to 
above $40 

„ „ Combination SMARTERM and 

Best Buy! EXPANDED CHARACTER SET 

Special at $260 

VIDEX, VIDEOTERM $249 

VIDEX ENHANCER II $119 

JMl CENTRONICS COMPATIBLE 
^ppr PARALLEL INTERFACE 

From PROMETHEUS. For use with Epson, NEC, 
C-ITOH, and other printers. Fully compatible with 
CP/M' and Apple Pascal'. 

PRT-1,0nly $69 

GRAPHini CARD 

Prints HIRES page 1 or 2 from onboard firmware. 
Features: True 1 :1 aspect ratio, prints emphasized 
mode, reverse mode, rotates 90 degrees . . . plus 
more. Compare all this with the Grappler. We think 
you'll agree that this is the best graphics card on 
the market. Specify for use with EPSON, NEC- 
8023, C-ITOH Prowriter, orOkidata. 

(List: $125) $89 

SOFTWARE 
WORDSTAR Special at $195 

SPELLSTAR $125 

SUPERCALC $175 

D BASE II $525 

VISICALC $149 

DB MASTER $189 

All equipment shipped factory fresh Manufacturers warranties 
included l^lease add $3.00 oer product for stiipping and fiandling 
California, add 6% tax. BART Counties. 6V2% 

All items are normally In stock 

Phone for Quick 
Shi]pment! 

[4tS) 490-3420 

... And we'll be here to help after you 

receive your order. Feel free to call the SGC 

Technical Staff for assistance. 

The mail order specialists 

342 Quartz Circle, Livermore, CA 94550 




MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



NO. 55 



DECEMBER 1982 



STAFF 

President/Editor-in-Chief 
ROBERT M. TRIPP 

Publisher 

MARY GRACE SMITH 

Editorial Staff 

PHIL DALEY — Technical editor 
JOHN HEDDERMAN — Jr. programmer 
MARJORIE MORSE — Editor 
JOAN WITHAM — Editorial assistant 
LOREN WRIGHT — Technical editor 

Graphics Department 

HELEN BETZ — Director 

PAULA M. KRAMER — Production mgr. 

EMMALYN H. BENTLEY — Typesetter 

Sales and Marketing 
CATHI BLAND — Advertising mgr. 
CAROL A. STARK — Circulation mgr. 
LINDA HENSDILL — Dealer sales 
MAUREEN DUBE — Promotion 

Accounting Department 
DONNA M. TRIPP — Comptroller 
KAY COLLINS — Bookkeeper 
EILEEN ENOS — Bookkeeper 



Contributing Editors 
CORNELIS BONGERS 
DAVE MALMBERG 
JOHN STEINER 
JIM STRASMA 
PAUL SWANSON 
RICHARD VILE 



Subscription/Dealer inquiries 
(617)256-5515 



DEPARTMENTS 

3 December Highlights 
7 Editorial 
9 Letterbox 
30 CoCo Bits 
32 From Here to ATARI 
35 MICRO News 
54 PET Vet 
65 APPLE Slices 
91 Updates/Microbes 
97 Short Subjects 
99 New Publications 
100 Reviews in Brief 
103 Software Catalog 

107 Hardware Catalog 

108 6809 Bibliography 

109 Datasheet 

111 Advertiser's Index 

112 Next Month in MICRO 



iMCftO 



THE 6502/6809 JOURNAL 



COMMODORE FEATURE 

It's All Relative — CBM Disk Techniques, 



37 

42 
47 

52 
59 



Part 1 James Strasma 

Get the most from CBM's powerful disk operating system 



Squeeze for PET Programs 

Squeeze out imbedded blanks, line separators, and comments 

BASIC Line Delete for PET/CBM and VIC 

A machine-language program to delete blocks of BASIC lines 



. Hans Hoogstraat 



Thomas Henry 



SOUP: A CBM Machine-Language 

Compare Program Henry Troup and James Strasma 

A compare program for machine-language program files 

Microcomputers in a College Teaching Laboratory, 

Part 2 Richard Heist, Thor Olsen, and Howard Saltsburg 

Analog transducers in a digital world 



BASIC AIDS 

-j o APPLE ILISZT for Integer BASIC Programs Leonard Anderson 



19 

22 
26 



Print your program in a clear, structured format and detect embedded binary code 

Kerry Lourash 



BASIC Macro Function for Cursor Control 

on the OS! 

Insert statements with just two keys 



. Paul Swanson 



ATARI Character Graphics from BASIC, Part 3 

Add to ATARI'S vertical blank interrupt routines 

APPLESOFT GOTO/GOSUB Checking Routine .. Peter j.g. Meyer 
Verify all GOTO and GOSUB references in your program 



HARDWARE 



69 
74 

77 
82 
85 
88 
93 



Adding Voice to a Computer 

A low-cost procedure for sampling and reproducing voice 



, Michael E. Valdez 



. David Cantrell and Terry Terrence 



. John Krout 



. David A. Hayes 



No. 55 - December 1982 



Enhanced Video for OSI C1 P . 

Add five chips — and several features 

Home Control Interface for C1P. 

Add your own ultrasonic control 

ATARI Meets the BSR X-10 

Use ATARI'S controller ports 

68000 Logic Instructions Joe Hootman 

Our discussion of the 68000 instruction set continues 

Programmable Character Generator for OSI coHn Macauiey 

Design your own character set 

Utilizing the 6502's Undefined 

Operation Codes Curtis Nelson, Richard Viiiarreai, and Rod Heisler 

Hardware to use these op codes for new pseudo-instructions 

MICRO - The 6502/6809 Journal 5 



Li;co Computer Marketing & Consultants 



TO ORDER 

CALL US 



TOLL FREE 800-233-8760 

In PA 1-717-398-4079 



December 

ATARI 
SPECIALS 



810 Disk Drive ... $429.00 

32KRAM $ 79.00 

40032KRAM ...$349.00 



800 48K... $609.00 




PERCOM : In Stock 

Single Drive CALL 

Dual Drive CALL 

(Read all Ateri Disks) 

PRINTERS : In Stock 

Epson Mx 80 $449.00 

Epson Mx 80 FT III $499.00 

OKIdata82A $479.00 

OKidata83A $719.00 

OKidata84 $1089.00 

CItoh CALL 

Prowriter I . $499.00 

Prowrlter II CALL 

SMITH CORONA TP-1 . $625.00 

NEC CALL 

(Interfacing Available) 

JOYSTICKS : In Stock 

Atari CX-40 $18.00 

LeStick $34.00 

WIco Command Control $24.00 

WICO RED BALL $27.95 

STICK STAND $ 6.75 

Computer Covers 

8OO $6.99 

*°° $6.99 

810 $6.99 

DISKETTES : In Stock 

Maxell M01 . . .(10) $34.00 

Maxell M02 ...(10) $44.00 

Elephant . . .(10) $21.00 

THIRD PARTY SOFTWARE 
ATARI PROGRAM EXCHANGE 

Eastern Front 1 941 ...$25.50 

Avalsncha . . $1 5.50 

Outlaw/Howitzer $1 5.50 

O09 Daze . $15.50 

Wizard of War $31 .00 

Gorf $31.00 

Frogger $26.00 

BUSINESS SOFTWARE : In Stock 

Atari Word Processing j^ 09.00 

Letter Perfect $1 29. OO 

Test WIzzard $ 89.00 

Datasam/6S $125.00 

Intertisp SI 25.00 

Monkey Wrench $ 42.00 

Utility Disk S 3e.bO 

Ultimate Renumber $ 15.50 



ATARI HARDWARE 

41 Cassette Recorder $75.00 

825 Printer $585.00 

830 Phone Modem $1 49.00 

850 Interface $1 64.00 

PACKAGES 

CX4ai Entertainer $69.00 

CX4a2 Educator $125.00 

CX483 Programmer $49.00 

CX494 Communicator $325.00 



SOFTWARE 

MISSILE COMMAND $28.75 

ASTEROID $28.75 

CE NTIPE DE $32. 75 

PACMAN $32.75 

STAR RAIDER $34.75 

BASKETBALL $26.75 

SUPER BREAKOUT $28.75 

SPACE INVADER $28.75 

CAVERNS OF MARS $31.75 

HANGMAN $1 2.75 

KINGDOM $1 2.75 

STATES a CAPITALS $1 2.75 

EUROPEAN COUNTRIES ■ $1 2.75 

GRAPHIT $1 6.75 

ENERGY CZAR $1 2.75 

SCRAM $19.75 

PROGRAMMING I $19.75 

PROGRAMMING It $22.75 

PROGRAMMING III $22.75 

TELELINK $21.75 

FRENCH $39.75 

GERMAN $39.75 

SPANISH $39.75 

SPANISH $39.75 

MUSIC COMPOSER $33.75 

ATARI BASIC $45.75 

MICROSOFT BASIC $65.75 

ASSEMBLER EDITOR $45.75 

MACROASSEMBLER $69.75 

PILOT HOME $65.75 

PILOT EDUCATOR $99.75 

HOME FILING MANAGER $41.75 
BOOKEEPER $119.75 



CXL401 2 

CXL401 3 

CXL4O20 

CXL4022 

CXL401 1 

CXL4004 

CXL4006 

CXL4008 

CX81 30 

CX41 06 

CX4102 

CX4112 

CX4114 

CX4109 

CX4121 

CX41 23 

CX4101 

CX41 06 

CX41 1 7 

CXL401S 

CX4119 

CX4118 

CX41 20 

CX41 20 

CXL4007 

CXL4002 

CX81 26 

CXL4003 

CX8126 

CXL4018 

CX405 

CX415 

CX414 



ATARI 

^B A Vtamer Communtcations Company 



THIRD PARTY SOFTWARE 

tor atari 800 or 400 

KBYTE 

KRAZY SHOOTOUT S35.O0 

•^■DOS S65.O0 

KSTAR PATROL S37.75 

KRAZY ANTICS S37 75 

KRAZY KRITTERS S37.75 

O-BALL JOYSTICK KIT $6.75 

AUTOMATIED SIMULATIONS 

Star Warrior S28.00 

Crush. Crumble S Chomp $23.00 

WE CARRY MANY OTHER THIRD PARTY PRODUCTS 
YOU CAN CALL FOR PRICES ON AND ASK FOR 
YOUR FREE ATARI PRODUCT CATALOG. 



NEW RELEASES 



CHOP LIFTER $27.75 

APPLE PANIC $23.75 

PREPPIE $19.95 



POLICY 



I In-Stock Items shipped within 24 hours of order* 
I Personal checks require four weeks clearance 

before shipping . PA residents add sales tax. 

All products subject to availability and price 
I change. Add A % for Mastercard and Visa. 



VIC-20 $189.00 

VICI 530 DATASSETTE $67.00 

VIC1 540 DISK DRIVE $499.00 

VICI 51 5 PRINTER $355.00 

VIC12103KRAM $35.00 

VIClnOSKRAM $52.00 

VICI 21 1 A SUPER EXPANDER $53.00 

VIC-20 SOFTWARE 

VICI 212 PROGRAMMER AID $45 00 

VICI 21 3 VICMON $45.00 

VICI 906 SUPER ALIEN $23 00 

VIC1914 ADVENTURE 

LAND ADVENTURE $35-00 

VICI 91 5 PRIVATE COVE 

ADVENTURE $3500 

VICI 91 6 MISSION IMPOSSIBLE $35-00 

V1C1917 THE COUNT ADVENTURE .... $35.00 

VIC1919SARG0N II CHESS $35 00 

THIRD PARTY SOFTWARE 

ALIEN BLITZ $21.00 

Omega Race $35.00 

Gorf $32.00 

1 6K RAM/ROM $99.00 

AMOK $21.00 

SUPER HANGMAN $16.00 

SPIDERS OF MARS $45.00 



TO ORDER 
CALL TOLL FREE 

800-233-8760 

in PA 1-717-398-4079 
or send order to 

Lyco Computer 
P.O. Box 5088 
Jersey Shore, PA 1 7740 



About the Cover 



200 Joyeu;-; No 



^ u ■-..' J D y e L.i ;■; r^j o e i 
3 Fall c e s h-' a s c n a s 
400 Bucn Natal e 
500 Happy Holidays 



This month MICRO is taking a holiday 
from presenting a graphic with a 
computer theme on our cover. Instead, 
we want to offer our warmest greetings 
— in five languages. The colorful lights 
in the picture belong to the city of 
Frankfurt, Germany and symbolize the 
festive glow of the holiday season. 
Froliche Weinachten! 

Cover photo by Phil Daley 



JMCAO is published monthly by: 
MICRO INK, Chelmsford, MA 01824 
Second Class postage paid at: 
Chelmsford, MA 01824 and additional 

mailing offices 
USPS Publication Number: 483470 
ISSN: 0271-9002 



Send subscriptions, change of address, USPS 
Fonn 3579, requests foi back issues and all 
other fulfillment questions to 

MICRO INK 
34 Chelmsford Street 
P.O. Box 6502 
Chelmsford, MA 01824 

01 call 

617/256-5515 

Telex: 955329 TLX SRVC 

800-227-1617 



Subscziption Rates Per Yeai 

U.S. $24.00 

2 yr. / $42.00 
Foreign surface mail $27 . 00 

Ail mail: 
Europe $42.00 

Mexico, Central America, 
Middle East, North Africa, 
Central Africa $48.00 

South America, South Africa, 
Far East, Australasia, 
New Zealand $72.00 

Copyright© 1982 by MICRO INK 
All Rights Reserved 



No. 55 - December 1982 



AVICftO 

Editorial 

Getting to Know You 

"It's more useful than my Swiss army 
knife." Now that's what we like to 
hear about MICRO and that's what one 
of you said in response to our reader 
survey. But we did the survey for more 
than a pat on the back. 

We did the survey to find out just as 
much as we can about who you are and 
what kind of information, both in 
editorial content and advertising, you 
need and want. 

We discovered that you are an ex- 
tremely well-educated, affluent, gain- 
fully employed bunch of people with a 
great deal of technical computer 
knowledge at your command — and 
you want more. 
33% of you have advanced degrees 
70% have incomes over $25,000 
60% are programmer/ analysts, en- 
gineers, or technicians, and 
90% of you have intermediate to ad- 
vanced knowledge of software and 
80% of hardware. 

No wonder only 6% of our readers 
consider MICRO too technical. Your 
biggest beef? Not enough information 
on your own system — whatever that 
may be. Too much Apple, not enough 
Apple, not enough Atari, not enough 
OSI. Now we know that that is going to 
be something of a problem in a publica- 
tion that covers more than one system, 
or more than one chip, but we think 
it's important to cross-fertilize, to 
generalize, to bring you knowledge and 
information that is transferable. Our 
goal is to make at least half of the 
magazine non-system specific, while 
dividing the other half in much the way 
our readers are divided — about half 
Apple and the other half heavily 
weighted toward OSI, Commodore, 
Atari, and 6809 systems. Interest in the 
6809 and 68000 remains high, especially 
among users who are adding boards and 
processors to 6502 machines. 

A great many of you (62%) use more 
than one kind of system and 46% have 
systems both at home and at work; 
nearly all of you plan to spend money 
adding more equipment during the 
coming year. We trust that the reviews, 
hardware and software catalogs, and 
advertisements are helping you make 
those purchases. 

There is a great proliferation of 
system-specific publications and more 
and more information for the beginning 
computer user. We are trying not to 



MICRO - The 6502/6809 Journal 



clutter up the magazine with informa- 
tion you already have — you've learned 
a lot over the last few years and we 
want to help you build on that knowl- 
edge. You've matured, the market has 
matured, and MICRO is growing along 
with you. The system-specific maga- 
zines are a great place to get hints, cor- 
rections, fixes, and details about your 
own equipment — the kind of material 
it made sense for us to publish back in 
1977 when no one else coverd the 6502. 
But now that manufacturers are doing a 
better job of providing documentation 
and there are lots of publications for 
begiimers, we want to concentrate on 
more advanced issues that cut across 
machine and processor lines, that keep 
you abreast of new developments and 
stretch your knowledge into new areas. 

micro's editorial schedule for the 
next year reflects that concern. This is 
the last system-specific feature we'll be 
running. Upcoming issues will feature 
various kinds of peripherals, languages, 
operating systems, communications. 
With your strong engineering back- 
ground you'll want to know what new 
processors are being developed and how 
they can be used even before they're 
available in complete systems. There 
are new programming languages being 
developed — we will look at what they 
are, which ones are worth pursuing for 
what purposes, etc. We will provide in- 
formation in the form of data sheets 
and information sheets on a variety of 
products and issues. And most in- 
teresting of all we will explore new 
modes of computer use: e.g., networks, 
communications, automated offices, 
and industrial control systems. 

We think that advanced computer 
expertise is b^t imparted in a journal 
that doesn't limit itself to one system 
or one chip or one operating system. 
After all, the whole industry is moving 
toward compatibility and we think that 
is a step in the right direction. In light 
of that fact, and as a result of all we've 
learned about you and your interests 
from the survey, as of next month (i.e., 
with the January 1983 issue), we will 
change MICRO'S subtitle to "Advancing 
Computer Knowledge." We are in no 
way abandoning the 6502 or the 6809 
or any of the specific systems we've 
been covering. We are, instead, making 
a statement about your technical exper- 
tise, your maturity and the industry's, 
and our desire to move toward ever in- 
creasing compatibility and wider pro- 
liferation of advanced information and 
knowledge. You — the sophisticated 
user — need your own publication; we 
hope it's MICRO. ^ 




/ 



Mary Grace Smith 
7 



7^^^^^^^^^^^^^ 



i ^/yC 



GEMINI- 

FOR PRINTER VALUE THAT'S 
OUT OF THIS WORLD 




Over thirty years of down-to-earth experi- 
ence as a precision parts manufacturer has 
enabled Star to produce the Gemini series 
of dot matrix printers— a stellar combina- 
tion of printer quality, flexibility, and reliabil- 
ity. And for a list price of nearly 25% less 
than the best selling competitor. 

The Gemini 10 has a 10 " carriage and 
the Gemini 15 a 1572 " carriage. Plus, the 
Gemini 15 has the added capability of a bot- 
tom paper feed. In both models, Gemini 
quality means a print speed of 100 cps, high- 
resolution bit image and block graphics, 
and extra fast forms feed. 

Gemini's flexibility is embodied in 
its diverse specialized printing 
capabilities such as super/ 
sub script, underlining, back- ' 
spacing, double strike mode 

and emphasized print mode. An- 

other extraordinary standard m i c r o n i 



feature is a 2.3K buffer. An additional 4K 
is optional. That's twice the memory of lead- 
ing, comparable printers. And Gemini is 
compatible with most software packages 
that support the leading printers. 

Gemini reliability is more than just a 
promise. It's as concrete as a 180 day war- 
ranty (90 days for ribbon and print head), a 
mean time between failure rate of 5 million 
lines, a print head life of over 100 million 
characters, and a 100% duty cycle that 
allows the Gemini to print continuously. 
Plus, prompt, nationwide service is readily 
available. 

So if you're looking for an incredibly 



/) high-quality, low-cost printer 
1^ that's out of this world, look 
^j;!^ to the manufacturer with its 
feet on the ground— Star and 
the Gemini 10, Gemini 15 dot 
I n c matrix printers. 



amary standard micronics » inc matrix printers. 

MAKING A NAME FOR OURSELVES 

1120 Empire Central Place, Suite 216, Dallas, TX 75247 
For more information, please call Bob Hazzard, Vice President, at (214) 631-8560. 



AMCftO 

Letterbox 



Back and FORTH 

Dear Editor: 

I was quite pleased with the two 
articles on FORTH in the June issue of 
MICRO. Regarding the benchmark 
comparisons of BASIC, FORTH, and 
RPL (page 63), I would have to say that 
Mr. Stryker is apparently somewhat 
biased in his viewpoint, since he is the 
father of RPL. What he appears to have 
done is take perfectly readable FORTH 
and translate it into hieroglyphics. 
Surely, the FORTH word DUP is more 
meaningful as a stack operator than 
"#", and who would ever guess what 
";'', "■", and "%" have to do with 
anything? Single-character words are 
very useful for lazy typists, but they do 
tend to produce "write-only" code for 
those who need to determine what a 
program is doing. 

Every FORTH implementation I 
have ever seen has a machine-language 
primitive to handle block moves on a 
character basis. Why do we go through 
the gyrations of listing IB when the 
word CMOVE would do just as well 
(actually better!)? Even without using 
CMOVE, the word BLKM would ex- 
ecute faster and with fewer FORTH 
words if it were written: 

: BLKM OVER + SWAP 

DO DUPC@ \C\ ^ + 
LOOP DROP ; 

This word expects a slightly dif- 
ferent order of things to be on the stack 
than originally specified: FROM TO 
and COUNT (634 826 150 using his 
numbers). This is the same order that 
CMOVE would expect them also. I am 
sure that this arrangement would be of 
benefit for RPL as well. 

Regarding the SHUFFLER bench- 
mark; first of all, it appears there is a 
typographical error of omission in line 
8 of listing 2B, since the word MOD 
referred to in the text is not there. Even 
so, however, the way the routine was 
implemented can do nothing but slow 
it down. 

Finally, regarding the Falling-Tone 
benchmark, I certainly feel the author's 



comments on page 68 regarding how 
hard it was to come up with a FORTH 
implementation, show a decided lack 
of understanding of structured pro- 
gramming! Listing 3A shows the same 
lack of structure that can be no way 
blamed on BASIC itself. After ana- 
lyzing what the program is supposed to 
do, the following structured code 
would have been much clearer: 

1010 DC = 20:FORZ = 20 TO 255 
1020 DC=DC-Z 
1030 IF DO = OTHEN 1020 
1040 POKE59464,Z 
1050 DC = DC -(-256 
1060 NEXT 

1070 POKE 59467,0:POKE 
59466,0:RETURN 

The same code written in FORTH 
looks like this: 

: TONE 59464 C! 16 59467 C! 
170 59466 C! 20 256 OVER DO 

BEGIN I -DUPO<: 

UNTIL 

1 59464 C! 256 + 

LOOP DROP 59466 ! ; 

Notice that we use 59466 ! to reset 
both 59466 and 59467 to zero, since 
FORTH inherently works with 16-bit 
numbers and uses 8-bit numbers only 
occasionally. I would probably do the 
same thing at the beginning of TONE 
to set up 59466 and 59467 initially, 
assuming this is a PIA register address 
of some sort. At any rate, the structure 
is there and can also be used in the RPL 
version, I'm sure. 

Edward B. Beach 

5112 Williamsburg Blvd. 

Arlington, VA 22207 



Dear Editor: 

In "BASIC, FORTH, and RPL" 
(MICRO 49:63), three different com- 
puter languages are compared in terms 
of speed and memory economy using 
three benchmark programs. However, 
within the text of the article there were 
some comments made about FORTH 



by the author, Timothy Stryker, which 
require rebuttal. 

Mr. Strsfker states that program 
modules in RPL do not execute directly 
but rather place their address on the 
stack where a second call operator (&.] 
actually executes this address. As cor- 
rectly noted, this is in contrast to 
FORTH where the defined word directly 
executes; it does not need a second ex- 
ecute operator. This allows all FORTH 
definitions to be treated as 
syntactically equal. Programmers may 
freely mix FORTH language words 
with their own new definitions — in- 
deed, there is no difference in the inter- 
nal dictionary structure between these 
two parts. 

On the other hand, RPL forces us to 
use (&) for execution of all new words 
while pre-existing ones are immune to 
this rule and execute directly, creating 
an inconsistent syntax. That this is 
memory efficient is doubtful. The 
higher level definitions of any non- 
trivial application program can consist 
of a large proportion of user-defined 
operators, each one of which would re- 
quire the addition of this execute 
operator in RPL. This probably con- 
sumes some memory in the compiled 
form and it certainly and unnecessarily 
clutters up the source code. With 
FORTH, the address of any definition 
can be placed on the stack with 
an additio:[ial operator when it is 
desired, although this function is 
seldom needed. 

It is true that FORTH handles sym- 
bols differently depending on whether 
they are variables, constants, or ex- 
ecuting subroutine names. This is part 
of the beauty of the language, not a 
weakness. Each type of symbol has a 
different function. Subroutine names 
execute, constants leave their value on 
the stack, and variables leave their ad- 
dress so we can suffix them with load 
or store operators. Nothing could be 
simpler or more efficient: uniformity of 
function by means of inconsistent in- 
ternal operation. RPL reverses this, 
giving us consistent internal operation 
while forsaking clarity of function at 
the programmer's level. This forces us 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



Letterbox (continued) 

to be even more aware of what each 
definition does — something I would 
prefer to be left up to my compiler. 

As Mr. Stryker correctly states, the 
FORTH string literal print word [.") 
and the numeric print words never 
leave their output string on the stack. 
This is seldom needed and would 
possibly slow down the system. 
Besides, the stack may not be large 
enough to safely handle this, since on 
the 6502 the FORTH stack is placed in 
page zero (shared with a few other 
FORTH locations and probably some 
used by the host computer for disk 
or terminal I/O). If we need to alter the 
string in numeric conversion and print- 
ing, FORTH has some primitives avail- 
able for inserting additional characters 
in the string. With a minor effort we 
can add print using to an application 
program or make it a permanent part of 
the FORTH we use each day. Other 
than the string literal defining word 
(."), there are no other string operators 
defined in the FORTH standards, but 
these are not difficult to add to such an 
easily extensible language. 



Some additional points: The mod- 
ulo primitive in the fig-FORTH 6502 
model takes 1.2 milliseconds to ex- 
ecute. No random-number generator is 
defined by the Group, so the poor speed 
of this word in Mr. Stryker' s unnamed 
FORTH version was not optimized for 
speed by whomever wrote it. 

Language experimentation and 
comparison is certainly needed to fuel 
the evolutionary process of computer 
technology. But it should best be done 
with the full understanding of each 
language involved. 

Raymond Weisling 

]al;m Citropuran No. 23 

Solo, Jawa Tengah 

Indonesia 



Dear MICRO: 

Thanks very much for the chance to 
respond to Mr. Beach and Mr. Weisling 
in regard to their letters concerning my 
recent article. 

First of all, I take exception to the 
contention in both of these letters that 
I unjustly biased the benchmarks and 
the conclusions drawn therefrom in 



favor of RPL. In fact, precisely because 
I knew that this objection might be 
raised, I bent over backward to give the 
benefit of every doubt to FORTH. This 
may not be immediately apparent in 
the article because I did not make a 
point of saying so, but, for example, 
wherever my measured execution 
times varied slightly from one run to 
the next, I uniformly presented 
FORTH' s fastest time, and RPL's 
slowest; for another, I specifically ex- 
cluded from consideration any bench- 
marks involving manipulation of 
character strings, stack-resident arrays, 
finite-state automata, and other opera- 
tions that RPL handles much more 
naturally than FORTH. Further evi- 
dence of this concern will become ap- 
parent below. 

First I'll address Mr. Beach and his 
comments on the use of single-character 
operator-tokens. I do agree that RPL 
source must look like hieroglyphics to 
a person versed in FORTH — but 
perhaps you remember what FORTH 
(or any computer language) looked like 
before you became fluent in it. Ex- 
perienced RPL users have as little dif- 
ficulty reading RPL source as you do 



• Professionat quality • Unlocked disketles * 1:*^ 
Apple II Requires Applesoft in ROM. 4SKRAiyfs'r^ 
Apple III Requires Business Basic and Mininuim<t! 
C' iCrihuti-d bv 
Educational Computing Systems ■^ 
106 Fairbanks Rd,, Oafc Ridge TN 37890 • StS?'^ 



»' OMNICOMP 

powerful data manipulation and numerical analysis system 

performs polynomial curve fitting, numerical interpolation, 

numerical integration, numerical differentiation and statistical 

calculations using entire data file or selected subsets 

extensive built-in hires graphics 

mathematical data transformations, plus averaging, smoothing, 

and lag/lead 

data files interchangeable with OMNIPACK programs 





mfk, enmbined \ \y-j 'A^ 'V^ 
fercharlsdrrcludinfi^ >5^ w5> ^ 
iiilbined lino dnd b.ii \ CLi •C» 

v^ Mi 

plots. 'but alt plot |.iiir-ir'iX n^ *^ 
ri9 menus to dllnvt, mil ^ ' j^^ 

iCtjcansform.itiniib un dnt.i \^ ^v 

graph rabfib "^ -'^ 



|f,?"" :Apple ril 

S74.95 

$74.95 

9,95 S64.95 

■2ft95 SI 69.95 

S?7a35 $99.95 

ping, in TN add 4V2% tax 

Id CMNI IS i iradinjrk nf FNDAC Ire 



10 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Letterbox (continued) 

reading FORTH. The advantages of 
single-character operator-tokens are 
three: 1. as you acknowledge, they cut 
down on typing time; 2. they cut down 
on the physical size of the source, so 
that more source can be fit into 
memory at once when undertaking 
nontrivial applications,- and 3. they 
speed up compilation by cutting down 
on the operator-token search time. 

Thank you for pointing out a better 
method of doing block moves in both 
FORTH and RPL. In writing the bench- 
marks, I was primarily concerned about 
making sure that the FORTH and RPL 
versions were as close to identical in 
approach as possible, so I missed seeing 
that the block move could be done 
more efficiently in the way you sug- 
gest. You may be interested to know, 
though, that the FORTH source you 
show for this routine yields an execu- 
tion jiffy-count of 717, considerably in 
excess of the 591 given for FORTH in 
the article. The reason? Your use of the 
composite "l-i-" operator in the 
innermost loop. When the sequence 
"1 -I- " is substituted for this, the ex- 
ecution time falls to 584 jiffies. Spaces, 
as you note in your letter aie important 
in FORTH — one might even say, alarm- 
ingly so. They make no difference in 
RPL. Unfortunately, the use of even the 
sped-up form of your block-move algo- 
rithm does not change the standings. 
FORTH requires 84 program bytes to 
do it in 584 jiffies, whereas the follow- 
ing RPL equivalent: 

BLKM: ; -I- 1 - % FOR # PEEK FN 
POKE 1 -I- NEXT . RETURN 

requires only 52 bytes to do it in 508, a 
"merit ratio" of 1.85 to 1. 

Now, there seems to be some con- 
fusion in your letter regarding various 
aspects of the SHUFFLER benchmark. 
To begin with, there are no typos any- 
where in the article. The MOD routine 
is, as stated, internal to the RND 
routine I used. This RND routine, 
modeled after that available under 
MMSFORTH, expects an integer passed 
to it on the stack, and returns a random 
number in the range from up to that 
integer minus 1 — hence, the MOD. 

Moving on to your comments re- 
garding the third benchmark: you are 
right. There was no need for me to in- 
troduce unstructured code in this case. 



The new FORTH TONE routine you 
exhibit takes only 3465 jiffies, and re- 
quires only 130 bytes of program space. 
The corresponding RPL routine is: 

TONE; 59464 POKE 16 59467 POKE 
170 59466 POKE 20 256 ;; FOR 
LOOP: FN - #0< IF 
FN 59464 POKE 256 -I- 
THEN LOOP GOTO END 
NEXT . 59466 ! RETURN 

which requires 83 bytes of storage and 
executes in 3338 jiffies. The resulting 
merit ratio of 1 .62 to 1 represents a con- 
siderable improvement. You were right, 
incidentally, not to condense the 
leading POKEs of 59467 and 59466 into 
a single store — the order of the POKEs 
into those 6522 VIA registers makes a 
big difference. 

On to Mr. Weisling's letter. Pro- 
. grammers who are bothered by the 
necessity of suffixing theii subroutine 
references with an ampersand in RPL 
are free to eliminate the space 
separating the two and thereby regard 
the composite "SUBRNAME8>." as just 
a one-keystroke-longer method of in- 
voking the routine. You doubt that this 
is memory efficient. Please find out for 
certain by way of the following pro- 
cedure: take any nontrivial FORTH ap- 
plication program to which you have 
access and count up the number of 
occurrences of (A) invocations of the 
thirty or forty real low-level FORTH 
"primitives" such as DUP, " = ", IF, 
DO, "@", and things of that nature 
(including ";" but not including ":")-, 
[Bj references to literal numeric quan- 
tities, whether CONSTANTS or not, it 
does not matter, which fall in the range 
from to 63; (C) references to literal 
numeric quantities greater than 63 but 
less than 32768, plus all references to 
VARIABLES, CVARIABLEs, and what- 
not; (D) all references to literal 
numeric quantities not covered under B 
or C; and [E] all routine-invocations 
(other than ":") not covered under A. 
Be sure, if you count a routine- 
invocation under E, that you also con- 
sider the body of that routine part of the 
program source. Now form the sum 
A-i-B-h2.C-i-3*D-h3*E. This is a 
rough approximation of the number of 
object program bytes that would be re- 
quired, were the program translated, 
absolutely mechanically from FORTH 
into RPL. Multiply this by about 0.8 to 
arrive at the memory size of the 



equivalent program, had it been de- 
signed in RPL to begin with. 

Next, a discussion on symbol 
handling. The fact that RPL is more ef- 
ficient has been demonstrated already. 
That it is simpler may be difficult to 
appreciate second-hand like this, but 
RPL "gives us consistent internal oper- 
ation" without forsaking "clarity of 
function at the programmer's level." 
The question of how aware the program- 
mer needs to be as to "what each defini- 
tion does" has nothing to do with it. 

The ability to manipulate character 
strings conveniently is fundamental to 
most user-oriented software develop- 
ment. Indeed, your remark about the 
size and location of the FORTH stack 
points up the fact that this is one area 
in which FORTH's extensibility does it 
little good. RPL locates both stacks in 
page one: the parameter stack is the 
hardware stack, and the return stack is 
an indexed sort of affair down below it. 
Stack-resident strings up to 60 charac- 
ters long or so can be manipulated free- 
ly without fear of crashing the machine 
— and execution is brought to a con- 
trolled halt if the 64-word stack entry 
limit is exceeded. 

And on your last point: under my 
version of FORTH, a public-domain 
version identifying itself simply as 
"fig-FORTH 1.0" (which, however, in- 
cludes such exotic facilities as double- 
precision and floating-point math, 
IEEE-488 I/O, etc.), the following 
routine, as timed with an actual watch, 
takes 2 minutes and 40 seconds to 
execute; 

: TEST 30000 DO 6543 52 MOD DROP 
LOOP ; 

When the MOD is replaced with an- 
other DROP, it takes 14 seconds. I leave 
you to draw your own conclusions. 

Timothy Stryker 

Samurai Software 

P.O. Box 2902 

Pompano Beach, FL 33062 

JMCftO 



Your opinions, comments, and 
ciiticisms can be aiied in MICRO too. 
Send mail to Letterbox, MICRO, P. O. 
Box 6502, Chelmsfoid, MA 01824. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



11 




CHRISTMAS SEASON 
SPECIALS! 

Let ARK COMPUTING Make This Your 
Best Christmas Ever! 



Super Fan II by R.H. Electronics 59.95/79.95 

Applicard, a high performance Z-80 card 

with 64K Ram, complete with CP/M 

4 mhz 324.95/445.00 

6 mhz 395.00/595.00 

Microsoft Z-80 card with CP/M and 

Microsoft Basic 

2 mhz 269.95/395.00 

Microtek Parallel Printer Interface complete 

with centronic compatible connector 

64.95/79.95 

Lazer Lower Case +Plus with Character 

Set +PIUS 49.95/84.90 

Lower Case +Plus alone 39.95/59.95 

Lazer Graphics +Plus 99.95/159.95 

Graphics +Plus and 

Lowercase +Plus 134.95/219.90 

Computer Stop 16K Ram Board 69.95/149.95 

Computer Stop Omnivision 80 Column board 
1 29.95/295.00 

Videx Video-term with Softswitch, inverse 

character set and 80 column Visicalc preboot 

295.00/450.00 

Wizard BPO 16K buffered printer interface 
(expandable to 32 K) 1 34.95/1 79.95 

Wizard 80, 80 column board 1 95.00/295.00 

Lazer Pascal 29.9'5/39.95 

Anix 1 .0 34.95/49.95 

Lazer Forth 44.95/59.95 

D Tack 68000 board for the Apple II 
with 4K Ram 895.00 

Lazer Model/32 (16032 board for the Apple II) 
CALL! 



Lisa 


59.95/79.95 


Lisa Educational Pak 


79.95/119.95 


Alien Ambush 


19.95/29.95 


Bandits 


19.95/29.95 


Cannonball Blitz 


24.95/34.95 


County Fair 


1 9.95/29.95 


Cranston Manor 


24.95/34.95 


Cycled 


19.95/29.95 


David's Midnight Magic 


24.95/34.95 


Dosource 3.3 


24.95/39.95 


Dueling Digits 


1 9.95/29.95 


Falcons 


21 .95/29.95 


Firebird 


21 .95/29.95 


Foosball 


1 9.95/29.95 


Horizon V 


25.95/34.95 


Genetic Drift 


19.95/29.95 


Kabul Spy 


24.95/34.95 


Jelly Fish 


19.95/29.95 


Lemmings 


19.95/29.95 


Labyrinth 


19.95/29.95 


Mouskattack 


24.95/34.95 


Outpost 


1 9.95/29.95 


Red Alert 


19.95/29.95 


Pig Pen 


24.95/34.95 


Russki Duck 


25.95/34.95 


Minatdr 


24.95/34.95 


Track Attack 


1 9.95/29.95 


Thief 


17.95/29.95 


Space Quarks 


19.95/29.95 


Snack Attack 


19.95/29.95 


Swash Buckler 


24.95/34.95 


Gin Rummy 


24.95/34.95 


The Dictionary 


69.95/99.95 


General Manager 


99.95/149.95 


4 Ft. Disk Cable 


19.95/29.95 


Visicalc 


179.95/250.00 


Using 6502 Assembly 




Language Book 


14.95/19.95 


Kids and The Apple 




Computer Book 


15.95/19.95 


Apple Panic 


19.95/29.95 


Kraft Joystick 


49.95/69.95 


/R^ 


^COMPBIIUBIIIC. 




..^rC^ ' Vour Salvation 


jm0"' 'v::-::-^^ 


In The Sea Of 


' / '■-'*' 


Inflation. 



714735-2250 

P.O. Box 2025 
Corona, CA 91 720 




12 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



APPLE I LISZT for 
Integer BASIC Programs 



by Leonard Anderson 



ILISZT prints an Integer BASIC 
program in a clear, structured 
format with the ability to detect 
embedded or attached BINARY 
code. 



ILISZT 

requires: 

Apple II with botli 
Integer and Applesoft 
Disk drive 
Printer 

The purchase of several disks at the end 
of 1981 added a number of Integer 
BASIC programs to my Apple II library. 
No listings were available and I decided 
to print all of them.' Several had 
embedded binary code, a condition that 
caused much "nonsense" display on 
both screen and printer. "LISZT" was 
already up and running (MICRO 
48:37 1, so it seemed logical to modify 
this Applesoft program to format In- 
teger listings. The ILISZT result kept 
the original format and added the abili- 
ty to find exact binary code addresses. 

ILISZTER is the formatting and 
printing program, run by EXEC file 
ILISZT. ILISZTER is Applesoft rather 
than Integer. While an Integer program 
might seem better, many Apple 11 
owners possess ROM or RAM cards for 
language duality and ILISZTER seems 
more compact in Applesoft due to 
string-handling capability. Another ad- 
vantage is that ILISZTER can be re-run 
without disk operations or loss of In- 
teger source code. 

ILISZTER retains the original 
features such as separation of con- 
catenated statements, indenting, and 
remark highlighting. Multiple-iterator 
NEXT statement handling for restoring 
FOR-NEXT loop indents is an improve- 
ment. The added binary code deter- 
mination and restoration routine is 
useful for listing certain utilities.^ 



Since Integer BASIC differs from Apple- 
soft, a brief review of Integer structure 
will help provide an Understanding of 
ILISZTER. 

Integer BASIC Source Code 

Figure 1 shows one line number of 
source code in Integer, The first byte 
contains the number of bytes per line 
with the next two bytes having the line 
number in binary. End-of-line is 
signified by the end byte having a value 
of one. 

Each entered line is immediately 
checked for syntax. Line numbers are 
limited to 32767 but may be modified 
by utilities. Numeric constants are 
converted to binary on entry, an advan- 
tage for program execution time. 

All function words are stored as 
one-byte "tokens" in the range of zero 
to 127 decimal. Punctuation, arith- 
metic, and logical operators are also 
tokens. Eight tokens are unused and 
three others are used only with key- 
board entries. ASCII characters have 
the high bit set to use the decimal range 



of 128 and 255. Token and character 
values are opposite that of Applesoft. 

A major difference also exists in 
handling numeric constants within In- 
teger. Certain functions permit a 
following numeric constant or variable 
name. Distinction of a numeric con- 
stant is done by making the first byte 
following an ASCII number [$B0 to 
$B9, not allowed as first letter of a 
variable) with the next two bytes con- 
taining the numeric constant in binary. 

Integer BASIC is located just below 
the highest free memory address. In- 
teger does not need the three-null end 
of program marker required by Apple- 
soft. Other details may be found in 
earlier publications. ^^ *■ ^ 

An EXEC File for Glue 

If an Integer program exists in 
memory, loading an Applesoft program 
will not destroy the Integer source code. 
Loading does change the Integer start-of- 
program pointer at $CB, $CA (203, 202) . 
Integer end- of -program, or HIMEM at 
$4D, $4C [77, 76) remains unchanged. 



Figure 1: Source code structure on one line number In Integer 



LINE NUMBER 
{16-BIT BINARY) 



BYTE 
COUNT 



LOW 



HIGH 



END-OF-LINE 
MARKER 



1 i T 

STATEMENT BYTES 

I i L 



$01 



ONE LINE NUMBER 



INCREASING 
MEMORY 
ADDRESS 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



13 



HIMEM will restore to the end of free 
memory on re-loading an Integer pro- 
gram; the mechanism is unknown but 
confirmed through experiments. 

EXEC file ILISZT is executed after 
loading the Integer program to be 
hsted. The first two POKEs in ILISZT 
generator MAKE ILISZT will move the 
Integer HIMEM pointer into the 
LOMEM space at $4B, $4A (75, 74). 
LOMEM also restores on Integer re- 
load. The last two POKEs move the 
start-of-program into the space nor- 
mally used for Integer HIMEM. 

Running ILISZTER will automatic- 
ally switch over to Applesoft without 
disturbing the new Integer start and 
end addresses. MAKE ILISZT can be 
deleted when EXEC text file ILISZT is 
generated. 

Starting ILISZTER 

The first line resets Applesoft high 
memory to prevent string operations 
from overwriting the Integer source. 
Token words are initialized at line 91. 
Since quotes are tokens if not in a 
remark, the DATA declaration uses an 
"&." symbol with conversion via the IF 
and CHR$(34! statement, 

A token evaluation array is gener- 
ated in V at line 96. The V array is used 
in line parsing to test unused tokens 
and tokens that may have following 
numeric constants. Unused tokens 
(V = 2) may be nulls or single spaces; 
spaces were written just in case the 
binary-insert routine crashed. 

The choice of lower-case characters 
in token words is up to the user. 
Mixed-case token words give distinc- 
tion from normal upper-case variables. 
Available utilities can edit upper-case 
source code by adding hexadecimal $20 
to each desired lower-case letter.' 

Initial display at line 98 is optional 
but it does indicate proper location and 
operation. The "DIFFERENT START 
ADDRESS" prompt allows listing to 
begin afteT an embedded binary; binary 
addresses will appear in normal print- 
outs. ILISZTER can be RUN after any 
RESET or list completion without 
disturbing Integer source code. 

Printer control in lines 107 to 110 
should be set to your particular printer 
and interface. Subroutines at lines 17 
and 18 can be changed to other runtime 
control. Source code control characters 
are converted to letters before output. 

Lines that Parse in the Right 

A source code line parse begins at 



ILISZTER 

PS = PEEK (77) * 256 + PEEK (76) - 1: fflMEM: PS: GOTO 82 

1 REM "GETT BOTE" SUBKOOTItlE * 

2 P = P + 1:B = PEEK (P): RETURN 

3 REM "blank: line priot" subroutine * 

4 D = 0: OOSUB 6: PRINT S$: RETURN 

5 REM "TEST PAGE SUBRDUTINE * 

6IjC = IjC+1:IFL::= <LP then REMORN : REM NOT A NEW PAGE 

7 GOSUB 17:LC - 6:PC = PC + 1: PRINT S$: PFJOT' BB$;LB$; "<oontinued> " 

8 REM A POFM-EEED FOR TOP OF NEXT PAGE; AUOWS VARIATION TOR DIFFEREIW P 

RINTERS. 

9 FDR K = 1 TO 4: PRINT S$: NEXT 

10 REM PREHT THE HEADER 

11 H$(4) = "Integer Page " + STR? (PC) : FDR K = 1 TO 4:E = IMT ( (LL - 

LEN (H$(K))) / 2) + 1: PRDTT M$; LEET$ (BB$,E) ;H$(K) : NEXT :K = FRE 
(0): PRIOT S$: IF NOT D TOEN RETURN 

12 REM POT LINE NUMBER IN BRACKEHS AS A STATEMENT IDENTIFICATION ON NEXT 

PRINT PRGE 

13 N$ = STR? ( VAL (N$)):K = LEN (N$): REM N$ IS NOW WTTHDOT SPACES; BR 

ACKET N$ AND ATTACH TO STATEMENT CHARACTERS 

14 C$ = RIGHTS (( LEFT? (IJB$, (6 - K) ) + CHRS (91) + N$ + CHR$ (93) + S 

$),8) + RIC5n;$ (C$,( LEN (C$) -8)):K= FRE (0): REOTRN 

15 REM * * MX-80 STANDARD/ITALICS SUBRDOTINES * * * 

16 REM "GRAPTRAX" Only. Single-character-set printers should DELEOT: the 

se calls throughout if not used for other print functions. 

17 PRD7T CHR$ (27)"5";: RETURN : REM ESC-5 IS STANDARD SET 

18 GOSUB 17: IF RF THEN PRINT CHRS (27)"4";: REM ESC-4 IS ITALICS SET 

19 RETURN 

20 REM HEXADECIMAL OCNVEKT SUBRDOTINE * 

21 A? = "": HEM OTTER WITO 'L' AS EECIMAL NUMBER, RETURN IN 'A?' 

22 FOR K = 1 TO 4:D = INT (L / 16) :E = INT ((L - (D * 16)) + 1):L = D: 

A$ = MID$ (XS,E,1) + AS: NEXT : REM PREFIX THE "$" HEX NOTATION 

23 AS = "S" + A$:K = FRE (0): RETURN 

24 REM BEGIN A NEW LINE NUMBER WITO TEST OF NUMBER OF BYTES IN LINE FRCM 

FIRST BYTE, THEN CONVERT BINARiT LINE NUMBER TO DECIMAL 

25 GOSUB 2: Iff P = > PE GOTO 123: REM PdNTER EQUAL TO OR BEXOND END OF 

INTHKER PROGRAM 

26 LA = PjBC -- B: IF B > 127 GOTO 114: REM B'frE COUNT TOO lARGE, PROBABLE 

ATTACHED BINARy 

27 TN = TO + 1: SSK BIJMP LINE NUMBERS, TOEN MAKE LINE NUMBER STRING 

28 GOSUB 2:L = B: GOSUB 2:L = B * 256 + L:B = LEN ( STRS (L)):N$ = RIGOTS 

(( LEETS (LBS, (7 - B) ) + STRS (L) + " "),8) 

29 REM BEGIN STATEMENT LINE PARSHiC WITH FII^ST-BYTE DEJCISION 

30 D = 0: GOSUB 2: IF B = 93 AND NOT RF THEM GOSLB 4: GOTO 34: REM SEPA 

RATE REM-K3R00PS BY BLANK LINES 

31 IF B = 93 AND RF OGfTD 34 

32 IF RF TOEN RF = 0: GOSUB 4 

33 REM RE-ENTRY POINT FDR NEXT BYTE IN STATIWENT DECISION 

34 IF B < 128 GOTO 39: REM BYTE IS A TOKEN 

35 IF B = 255 TOEN B = 159: REM RUBOOT (SFF) BECOMES UNEERLINE BETWEEN B 

ARS 

36 B = B - 128: IF B < 32 TOEN B = B + 64:G$ = GS + CHRS (124) 

B) :B = 12:4: REM PUT OCNTROL CHARACTERS BETWEEN BARS 

37 G$ = G$ + CHR$ (B): GCGUB 2: GOTO 34 

38 REM TOKENS 

39 IF V(B) > 1 TOEN G$ = "": GOTO 114: REM [INUSED TCTCEN, 

PROGRAM ATTACHED SO GATHERING IS NULLED 

40 IF B = 1 OR B = 3 THEN GS = GS + S$: (XfK.) 57: REM FORCE A NEW PRINT L 

INE ON E-O-L OR A COLON DEXIMITER; SPACE'. ATTAOED TO PREVENT PRINT-L 
INE CRASH 

41 IF B = 93 THEN TR = TR + 1:RF = 1:RS = 1 : REM A "REM" 

42 IF B = 37 AND PEEK (P + 1) = 85 THEN G$ = G$ + T$(B):CF = 1: GOTO 57 

: REM FORCE A NEW LINE ON "THEN" FOUjOWED BY "FOR", SET CONDITIONAL 
FLAG 

43 IF B = 85 THEN FF = 1: REM A "FOR" 

44 IF B < > 89 GOTO 51 : REM SKIP AROUND A "NEXT" 

45FS = FS-1:PT = P+1: IFCF THEN FS = F£; - 1 : REM DECREMENT "FOR" SP 
ACER CN "IF" FU«3 SET, BEGIN SCANNING AHEAD FOR 2 OR MORE ITERATORS 

46 BT = PEEK (PT) : IFBT = 10RBT = 3 GOTO 49: REM NO OTHER ITERATOR 

47 IF EfT = 90 THEN FS = FS - 1 : REM CCMMA FCUND, ISJCREMENT "FOR" SPACER 
48Pr = FT + l:IFPT< =(IA + BC) GOTO 46: REM CHECK AGAIN FOR ANOTHER 

CCWA WITHQI LINE 

49 IF FS < THEN FS = 

50 REM GATHER Tt»CEN THEN TEST FOR A FOIiOWING 3-BYTE NUMBER GROUP 

51 GS = G$ + TS(B):L = B: GOSUB 2: IF V(L) = GOTO 34: REM NO NUMBER SHO 

ULD FOLLOW 

52 IF B < 176 OR B > 185 GOTO 34: REM THE $B0-$B9 FIRST-BYTE NOT THERE S 

O NO NUMBER POIIDWS. FALL-THKDOOJ IGNORES FIRST-BYTE AND DOES DBCIM 
AL STRING CONVERSION 

53 GOSUB 2:L = B: GOSUB 2:L = B * 256 + L:GS = G$ + STRS (L) : GOSUB 2: GOTO 

34 

54 REM ADD EXTRA INESNT EACH SPLIT LINE, 

55 TS = TS - 1:SF = 0:RS = RS + 1: IF BS 

56 REM FIRST ENTRY TO PRINT-LINE BUILD, 

IT-POINT :L0W LIMIT 'E' 

57 TS = TS + 1:K = IM * (FS + RS) :E = K + 13: IF K 

BBS,K) + GS 



+ CHRS ( 



PROBABLE BINARY 



LIMITING ON "REM" STATEMENTS 
> 2 THEN BS = 2 
GET TOTAL INDENT SPACES PLUS SPL 



THEN GS = LEFTS ( 



14 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



45 OR 



(continued) 

58 RIM BUILD TOTAL PRINT-LINE STRING 

59 IF NOT D THEN C$ = N$ + G$ 

60 IF D THEN C$ = LB$ + G$ 

61 REM TEST FDR LC*C LINE, SPLIT IF NBCESSAJW 

62 K = LEN (C$) - LL: IF K < 1 GOTO 74: RIM NOT A SPLIT LINE 

63 G$ = RIGOT? (C$,K):C? = LEET$ {C$,LL):SF = 1 

64 RIM BBSIN SPLITTING WITH SEARCH FDR A SPACE 

65 D = LL 

66 IF MID$ (C$,D,1) = S$ GOTO 72 
67D = D-1: IFD>E GOTO 66 

68 D = LL: REM SPLIT NEXT AT ARITWETIC OPERATOR OR OCMMA 

69 K = ASC ( MID$ (C?,D,1)): IF K = 42 OR K = 43 OR K = 44 OR K 

K = 47 OR K = 124 GOTO 72 
70D = D-1:IFD>E GOTO 69: RIM FALL-THROUGH IS NO SPLIT 

71 GOTO 74: RIM NEXT LINE IS SPLITTING INSTRUCTION 

72 K = LL - D: IF K > TOIN G$ = RIOTT? (C$,K) + G$:C$ = LEFT? (C$,D) 

73 REM TEST PAia; LINE-COUNT, INSERT SPACES AS RB3UIRED, TOIN PRIOT 

74 QOSUB 6:K = I£N (C$): IFSF = 0ORK< 2 0RRF THEN 77: REM FORGET M 

ARKENG UNDEELINIM3 ON "REM"S 

75 IF MrD$ (C$,K,1) = S? THEN C$ = LEFT? (C$,(K - 1)) + CHR? (95): RIM 

PUT A TRAILING UNDERLINE AT lAST SPACE AS A MARKER FOR THE LEFT-HAND 
STRING 

76 IF I£N (G$) > 2 AND LEET$ (G$,l) = S$ THEN G$ = CHR? (95) + RIOTT? 

(G$, ( I£N (G$) - 1)) : REM POT A LEADING UNDERLINE AT FIRST SPACE OF 
RIGOT-HAND STRING AS A MARKER 

77 GOSUB 17:K = UM (C$): PRINT M5; LEET$ (C$,8);: GOSUB 18: PRIOT RIOTT? 

(C$,(K - 8)):K = PRE (0): IF SF THEN D = 1: GOTO 55: RIM PRINT REST 
OF A SPLIT LINE 

78 RS = 0: IF FF THEN FS = FS+1:EF = 

79 D = 0:SF = 0:G$ = "": IF B = 1 GOTO 25: RIM GET ANOTIHER LINE NWEER IF 

E-O-L, ELSE FALL 1HR00GH AND GETT ANCnHER STATIMEMT 

80 GOSUB 2:D = 1: GOTO 34 

81 RIM INITIALIZATION OF VARIABLES 

82 DIM T$(127),H$(4),V(127) 

83 RIM INITIAL VARIABLE SETTING HAS AN aO-CHARACTER WIEE PRINT LINE AND 

82-LINE PAGE LfNSIH (INCLUDDK HEADER, EXCLUDING 'OOWnNUED' INDICAT 
OR) ; CHANGE LL AND LP AS DESIRED FOR OTHER POEMAT SIZE. 

84 PE = PEEK (75) * 256 + PEEK (74) - 1:P = PS: RIM PS = INTEGER PROGRA 

M START ADCKESS MINUS CHE, PE = DSnBGER PROGRAM STOP ADDRESS MINUS O 
NE 

85 B = 0:LL = 80:LP = 82:IM = 4:TN = 0:TS = 0:TR = 0:S$ = " " :X$ = "01234 

56789ABCEEF" :C$ = "■':G$ = "":N$ = "":M$ = "":IB$ = " ":BB5 = 



86 REM 'T$' ARRAY STRING OCMSTANTS FOR PRINTItB TOKEMS 



87 DATA 



',"IiDad ","Save " , "Ccxi" , "Run ", "Run", "Del ",", 



," Step 
Print ", 
","," At 



',"N 
'Pri 



, "IfciDsp " , " 
CHRS (34): 



1,1,1,1,1,1,1,1, 
0,0,0,1,1,1,0,2, 
1,0,0,1,1,0,1,0 



New" , "Clear" , "Auto ",",", "Man ","Himem : ","Lan6in : ","+","-",'•*","/ 

"," = "," # "," >= "," > "," <= "," <> "," < "," And "," Or "," Med 
","""," ","(",","," Then " 

88 DATA " Then ",",",",","&",'%","("," "," ","(", "Peek" , "Rnd", "Sgn", "Abs 

","Pdl"," ","(","+","-", "Not ","("," = "," # ","Len(","Asc(","Scm(" 
,",","(","$"," ","(",",",",", " ; " , " ; ",":",",",",",",", "Text" , "Gr " , "Ca 
11 ","Dim ","Diin ".'"Tab " 

89 DATA "End", "Input "," Input ", "Input " , "Etir "," = "," To 

ext ",",", "Return"," Gosub ","* "," "," GcTo ","If ", 
nt ", "Print" , "Poke ",",", "Color = ","Plcrt ",",","HLin ",' 
VLin ",",", " At " , "VTab " 

90 DATA " = "," = ",")"," ","List ",",", "List" , "Pop" , "tfeDsp ' 

ttoTrace" , "Dsp ","Dsp ", "Trace" , "Pr # ","In # " 

91 FDR K = TO 127: READ T$(K) : IF T$(K) = "&" TOIN T$(K) = 

REM ONE WAY TO GET A DOUBLE CXETTE INTO A STRING 

92 NEXT 

93 REM 'V ARRAY CONSTANTS FOR TOKEN TESTDK 

94 DATA 2,0,2,0,0,0,0,1,0,1,1,0,0,2,2,2,1,1,1,1,1,1,1,1. 

1,2,1,1,1,0,0,0,0,0,1,2,2,1,0,0,0,0,0,2,1,1,1,1,1,0, 
1,1,1,0,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0, 

95 DATA 1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,2,1,1,0,0,0,0,0,0,0,0,1,1 

96 FDR K = TO 127: READ V(K) : NEXT 

97 REM SCREEN PRCMPTS AND OPERATOR ALTERNATES 

98 HUE : TE3CT : VTAB 2: HTAB 12: INVERSE : PRXNT " ILISZTER ACTIVE ": NORMAL 

: VTAB 4:L = PS + 1 : GOSUB 21: PRINT "START OF INTEISER PROGRAM: ";AS 
:L = PE: GOSUB 21: PRINT " END OF INTECER PROOWM: ";AS: REM OPTION 
AL TO CHECK APPROXIMATE ADDRESS LOCATION 

99 PRINT : INPUT "PROGRAM NAME: ";H?(1): INPUT " PROGRAfrMER: ";H$(2): INFOT 

CATE: ";H$(3): REM REQUIRED FOR HEADER ON EACH PAGE 

100 PRINT : PRINT "WANT DIFFERENT START ADDRESS ?": GET AS: IF AS < > " 
Y" GOTO 103 

101 mPOT " START ADDRESS (HEX): ";AS:D = 1:BT = 0: FDR K = LEN (AS) TO 
1 STEP - 1: FOR E = 1 TO 16: IF MID$ (AS,K,1) = MID? (X$,E,1) THEN 
BT=D*(E-1)+BT 

102 NEXT E:D = D * 16: NEXT K: PRINT :P = BT - 1:L = BT: GOSUB 21: PFONT 

HEX ADDRESS = ";AS;" CHANCT: ?": GET AS: IF AS = "Y" GOTO 101 

103 PRINT : PRXNT "NO LEFT MARGIN, WANT ONE ?": GET AS: IF AS = "Y" IHIN 

INRJT " MARGIN SPACES: ";K: IF K > AND K < 49 TOIN M? = LEET$ ( 
BB$,K):LL = LL - K 

104 REM REMINDER FOR PRINTER SEH'-UP , .. ,, 

(continued) 



line 25. Integer does not allow a byte 
count larger than 127. (The actual 
number is 255. The 127-byte limit [line 
26) is for print-line reconstruction, 
usually longer than source-code line 
length.) A byte count that is too large 
will jump to the binary-insert routine 
at line 114. Line numbers up to 65535 
will output whether they are actual 
line numbers or a chance byte-pair in 
binary. A test of number magnitude 
was included in an earlier version but 
then disregarded due to the large 
number of starting prompts. 

Remark checking in lines 30 to 32 is 
part of the blank-line separation for 
REMs. Removing separation would 
delete all but the "D = 0" statement; D 
must remain for line number printing. 

Statements begin parsing in line 34, 
ASCn characters are restored for print- 
ing but control characters are upper- 
case between vertical bars. Source code 
rubouts are included to fill out lines in 
certain programs.^ 

Token parsing begins at line 39 with 
a test for unused tokens. The added 
space to the gather string at line 40 
prevents a crash during a binary code 
test; a rare condition, but it was found 
in two listings. 

Three programs were found with a 
FOR loop starting on an IF-true condi- 
tion. Line 42 solves indenting and 
restoration on this rare case. Integer 
normally executes only one IF-true 
condition but, apparently, a FOR loop 
will execute until completed. 

Two or More Iterators 

The printout indent restoration of 
statements such as "NEXT f,K" is 
solved by the search routine in lines 45 
to 49. Of several comma tokens, only 
decimal value 90 is the comma in a 
multiple-variable NEXT statement. 
This search and find will restore global 
indenting of FOR loops. It can also be 
patched into the original LISZTER to 
solve an oversight.'' 

Numbers Following You? 

Some tokens allow following 
numeric constants. Integer BASIC flags 
a numeric constant with a $B0 to $B9 
prefix (ASCII numbers to 9). The test 
in lines 51 and 52 check for token and 
prefix, ignoring the prefix if it exists. 

Line 53 builds the numeric constant 
string and gathers it in G$, Flow must 
return to line 34 afterwards. The next 
byte can be either a token or a char- 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



15 



acter; variable names are ASCII 
characters. 

The Final Print Line 

Lines 55 to 80 form the output print 
hne, splitting and indenting as in the 
original LISZTER. First-priority split is 
still a space, but second-priority split 
has a vertical bar added to line 69. Con- 
trol characters seem to be used more in 
Integer. At this point they have been 
converted to upper-case letters between 
bars and will not upset printer control. 

The complex print statement group 
in line 77 is solely for the italics 
capability of the Epson printer. A 
single-character-set printer can 
substitute a simple "PRINT M$; C$" 
for both GOSUBs and PRINTs. 

Possible Binary? 

An IF-true test at lines 26 or 39 in- 
dicates something is wrong with the In- 
teger source code. More than likely it is 
due to embedding binary code with in- 
teger. The routine at lines 114 to 120 
checks this condition. 

Variable LA is made up of the ad- 
dress of each new source line number 
start. That address is converted to hex- 
adecimal and printed with the "Possi- 
ble Binary From" indicator. A search 
now begins for any byte group meeting 
the following: the group is below 
HIMEM, the group is less than 128 
bytes long, and the end-of-line byte 
value is found from the first-byte ad- 
dress plus value. A successful search 
will print the byte group last address in 
hex to complete the indicator, then 
return to line 25 for a new source line 
number. 

The indicator may be printed 
several times before a correct source 
line is found. The number of prints will 
be dependent on binary content but a 
correct Integer source line will always 
follow embedded binary. 

A possibility is a bit error in 
memory that can yield another possible 
binary print line. An advantage is that a 
printout will show beginning and end- 
ing addresses for closer examination. 

An "attached" binary program will 
terminate at highest available memory. 
The possible binary last print will in- 
dicate this as $95FF with standard DOS. 

Alternatives 

A purely Integer version of 
ILISZTER can be written by translation 
of the general structure. Page zero loca- 
tions $69 through $6D can be used for 



(continued) 



105 



': PRINT " 

": NOFMAL 



CHES(9)=CTRL 



HCME : INVERSE : PRINT " SET PAPER TO TOP OF FDFM 
THEN ": PRINT " TORN Q!I PRINTER 

: GET A? 

106 R£M SET S3JEEN WIETH, TORN ON PROPER PORT 

107 HCME : POKE 33,30: PR# 1 

108 REM CONTRDL CHAPflCTEIBS FOR MX-80 WITH "GiRAPFI£R" CARD. 
-I, CHR$(:27)=ESC 

109 PRINT CHRS (9)"82N" CHRS (27)"0" CHRS (9)"I" 

110 REM 

111 REM SETr-UP TO START FIRST PRINT PAGE 

112 U: = 6:PC = 1:D = 0: GCSUB 11: GOTO 25 

113 REM POSSIBLE-BINARY INSE3?T/ADDITICIN ROUTINE 

114 BF = 1: GOSUB 18:L = LA: GOSUB 21: GOSUB 6: PRINT M5;LB5;" >>> Possib 

le Binary frcm ";A5;" to "; 

115 IF P > PE GOTO 121 

116 IF B > 127 THEN GOSUB 2: GCnT) 115: REM BYTE-COUNr TOO LAR3E 

117 Pr = P + B-l:BT= PEEK (PT) : IP PT > PE GOTO 121 

118 IF BT < > 1 OR B < 5 THEN GOSUB 2: OOXO 115: REM NO E-O-L OR BYTE- 
COUNT TOO SMALL 

119 IF lA = (P - 1) THEN GOSUB 2: GOTO 115: REM ATOID KEPETITICIN; SCMEH 
OW THE POIOTER DIDN'T ADVANCE 

120 P = P - 1:L = P: GOSUB 21: PRINT AS:D = 0:G$ = "": GOTO 25: B£M RETTUR 

N TO LINE-NUMBER STAPT 

121 L = PE: GOSjUB 21: PRINT A? 

122 REM ENDING ROUTINE 

123 GOSUB 4: C»SOB 17: PRINT MS;IB5;"End of Usting" 

124 REM OPTICHAL STATISTICS 

125 GOSUB 4: PRIOT M? ; "Program Length = ";(PI! - PS) 
;TN;" Line Nuntoers": GOSUB 4: PRINT M5;(TS - TR);" 
tements, ";TR;" Tbtal Ranarks" 
REM TURN OFF PKINTER, KtKtT SCREEN AND SHOW COMPLEmCIN 



Bytes, Tbtal of " 
Tbtal Ifcn-Rati Sta 



126 
127 

128 

129 

130 

131 

132 

133 

134 

135 

136 

137 

138 

139 

140 ' 

141 

142 

143 

144 

145 

146 

147 

148 

149 

150 

151 

152 

153 

154 

155 

156 

157 

158 

159 

160 

161 

162 

163 

164 

165 

166 

167 
168 
169 

170 
171 
172 
173 
174 



PR# 0: POKE 33,40: HCME : VTAB 12: HTAB 10: INVERSE : PRINT " END OF 

ILISZTINC; ": NORMAL : END 
REM "ILISZTER" program to re-format TNTEGER BASIC listing prints 
REM by Leonard H. Arrierson Version 2.8.8, 15 May 1982 
REM lower case eind italics for MX-80 & "GRAETRAX" 
REM EOssiible-Binary routines added to 2.8.1 (21 March 1992) 
REM 

REM rasau-prioN of variables: 

REM 

TEMPORARY STRING, PARTLY FOR HEX CONVERSION 
PROGRAM BYTE VALUE IN DECIMAL 

BIG BLANK' STRING OF 48 SPACES 
BYTE-COUNT CF A LINE, DECIMAL 
TEMPORARY PROGRAM BYTE VALUE IN DECIMAL 
"IP" FLAG: SETT ONLY ON "IP" FOUO/iED BY "FOR" 
CHARACTER AND TOKEN STRING TO BE PRINTED 
TEMPORARY, PARTLY FOR 'DIRECTION' 
TEMPORARY, PARTLY FOR SPLIT-LINE LIMITS 
"lOR" FLAG: 1 = "FOR" STARTED, = NO "FOR" 
"EOR" INDENT SPACE COUNTER 
'CATHER' STRING TO BUILD A STATEMENT 
HEADER ARRAY FOR PRINT-PAGE TITLE: 
INDENT SPACE MULTIPLIER 
TEMPORARY 

TEMPORARY, PARTLY FOR LOW-BYTE VfiLUE 
LINE NUMBER BEGINNING ADDRESS 
LINE COUNTER FOR PAGLNATICIN 
UNE-UNGTH CONSTANT 
'LITTLE BIANK' STRING OF 8 SPACES! 
IZET MARGIN SPACING STRING 
UNE NUMBER STRING 
PCilNTER TO PROGRAM BYTE, DECIMAL 
PAGE OOUWTER FOR PRINT-PACT! HEADEiR 
INTEGER PROGRAM END ADDRESS, DECIMAL 
INTE(3:R PROGRAM START ADDRESS, CSCIMAL 
■TEMPORARY POINTER TO PRDOWM BYTE!, DECIMAL 
"REM" FLAG: 1 = "REM" STARTED, = NO "REM" 
"REM" INDENT SPACE COUNTER 

SPLIT-LINE FLAG: SETT IP PRINT LUSE MUST BE SPLIT 
SINGLE-SPACE STRING 
TOTAL LINE NUMBER COUNTER 



REM A? 
REM B 
REM BB$ 
REM BC 
REM BT 
REM CF 
REM C$ 
REM D 
REM E 
REM FP 
REM FS 
REM GS 
REM H$ 
REM IM 
REM K 
REM L 
REM lA 

REM u: 

REM LL 
REM IB? 
REM M? 
REM N5 
REM P 
REM PC 
REM PE 
REM PS 
REM PT 
REM RF 
REM RS 
REM SF 
RIM S? 
REM TN 

REM TR 
REM TS 
REM T$ 
REM V 
REM 
REM 
REM 
REM X? 



TOTAL REMARKS COUNTER 
TOTAL STATEMENTS COUNTER 
TOKEN STRING ARRAY 
ARRAY FOR TOKEN EVALUATTCN: 

= NO BINARY NUMBER FOIiOWS TOKEN 

1 = A a-HYTE BINARY NUMBER POUCWS 

2 = UNUSED/ INTERNAL, DO NOT PRINT 
HEX CHARACTER STRING FOR OCHVERSIOilS 



16 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Make ILISZT 


200 


* TEXT FILE GENERATCK TOR "ILISZT" 


210 


* VERSION 3.0, 16 APRIL 1982 LHA 


220 


D$ = "iDl" 


230 


Print D$;"OPEN ILISCT" 


240 


Print D5r "WRITE ILISZT" 


250 


* MAKE INltJiEK LLMtM RJiWl'ER HCgJ5 ENDING OF lOTTnFR PROGRAM 


260 


Print "POKE74,EraK(76)" 


270 


Print "POKE75,EraK{77)" 


280 


* MAKE INl-KJEK EHMEM POItnER SOLD STAFET OF INTEGER PRDOWM 


290 


Print "POKE76,PEEK(202)" 


300 


Print "POKE77,PEEK{203)" 


310 


Print "HUN ILIS27rER" 


320 


Print D$; "CLOSE" 


330 


End 



pointer re-arrangement as in the LISZT 
predecessor. Total code will probably 
exceed the 4.5K bytes of a "REM-less" 
ILISZTER in Applesoft. MAKE ILISZT 
can be either language; the created text 
file will be the same. 

ILISZTER has successfully handled 
a 23K Integer program printout plus 
one program with two embedded 
binary code sections. 

References 

1. Apple Pugetsound Program Library 



Exchange "public domain" disks 
(members only). Printouts of 1057 
programs fill three large loose-leaf 
notebooks; about a quarter are 
Integer. 

2. "Higher Text" by Ron and Darrell 
Aldrich, Call —A.P.P.L.E. version. 
One Integer program has two binary 
embedments. 

3, MICRO on the Apple, Volume 1, 
MICRO INK, pages 198-203. 

A.PEEKing at Call —A.P.P.L.E., 
Volume 2, pages 44-61, Apple Puget- 



sound Program Library Exchange, 
1979. 

5. What's Where in the Applet, 
William F. Luebbert, MICRO INK. 
For address locations only. 

6. "The Inspector," Omega Micro- 
ware, Inc., is one example of a disk 
or memory byte-changer utility. 
Although the author has upper-/ 
lower-case conversion on the key- 
board, this utility was used to cor- 
rect typos in ILISZTER' s DATA 
statements. 

7. "LISZT with Strings," Richard F. 
Searle, Don Cohen, Leonard H. 
Anderson, MICRO, May 1982, listing 
2 on page 41. The easiest patch is a 
GOSUB in line 45 just after the 
"CF = r' statement; the subroutine 
would look for a delimiter comma in 
ASCII, such as "BT = 44", to decre- 
ment the FOR spacer. 



You may contact Mr. Anderson at 10048 
Lanark St., Sun Valley, CA 91352. 



JMCRO 



EVER WONDER HOW YOUR APPLE II WORKS? 

QUICKTRACE will show you! And it can show you WHY when it doesn't! 

This relocatable program traces and displays ttie actual machine operations, while it is running and 
without interfering with those operations. Look at these FEATURES: 



SInglm-Stmp mode displays the last instruction, 

next instruction, registers, flags, stack contents, 
and six user-definable memory locations. 

Traca mode gives a running display of the Single- 
Step information and can be made to stop upon 
encountering any of nine user-definable 
conditions. 

Background mode permits tracing with no display 
until it is desired. Debugged routines run at near 
normal speed until one of the stopping cond- 
itions is met, which causes the program to return 
to Single-Step. 



QUICKTRACE allows changes to tfie stacic, 

registers, stopping conditions, addresses to be 
displayed, and output destinations tor all this 
information. All this can be done in Single-Step 
mode while running. 

Two optional diaplay lormata can show a sequence 
of operations at once. Usually, the information 
is given in four lines at the bottom of the screen. 

QUICKTRACE is completely transparent to the 
program being traced. It will not interfere with 
the-stack, program, or I/O. 



QUICKTRACE is relocatable to any free part of 

memory. Its output can be sent to any slot or to 
the screen. 

QUICKTRACE is completely compatible with 

programs using Applesoft and Integer BASICS, 
graphics, and DOS. (Time dependent DOS 
operations can be bypassed.} It will display the 
graphics an the screen while QUICKTRACE is 
alive. 

QUICKTRACE is a beautiful way to show the 

incredibly complex sequence of operations that 
a computer goes through in executing a program 



Prica: SSO 

QUICKTRACE was writter} by Johrt Rogers. 
QUICKTRACE is a traOetnark ot Anthro-Digital. Inc. 



QUICKTRACE requires 3548 (JEOO) bytes (14 pages) o< memory and some knowledge of machine language programming 
It will run on any Apple II or Apple II Plus computer andean be loaded from disk or tape. It is supplied on disk with DOS 3.3. 



QUICKTRACE DEBUGGER 



La$t tn$tructlon 



Stack 



Contantt 



Next Inatruction 



La$t addntt 

f~F69- A9 AA 



DIaanemttly 

LDA #$AA 



Top Mwn byftM of $tack 



Prooaaaor codea Uaer daUnad location A Contanta 



ST=7(: 

Accumulator 

A=--=AA 
f-F6B- 



a: 



X mg. 

X-9S 



:.^- l.,'D 
Ymg. 

Y-25 



43 D4 CI NV-BDIZC 0000- 



Slack pointer 

SPn^:F2 PS 



Procaaaor atatua Con^nt ol nianncad addmaa 

aOl 10001 {]=DD 

Dluammbly Ralaninc. addrw AnthrO-Dlgital, IhC. 

STA *33 I $0033 1 P.O.Box 1385 

Pittsfield, MA 01202 

413-448-8278 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



17 




ttaSa-lntelwt 

Hi 



Ikis 15 > Mf If If n ctliayt wfKt hih 

mm M loRT cna dvicvs E iril « >.—— -■ ■- 

bsf» [teKiHs en bt nxiHtni^ ki dafiat >Ik n-lii*t Etncts 

liOfriTar 

II ttis Mita<. artcter all ::ai oitar ilai ISi starirl U ca k« 



im. 



tiJiTlMftiis «r 5«(fw» ielecTitli if n tti2i 

n<r a;? itH huriits Si Hz £< a* hi vita 'WHK wilj 
IK so-; •!» He ■ BI-T3PI !:»*) <i;l anTiilir nfaii if MriiiK 
2!» hw iKl) ir I bKt *iws 

HK Sa-3 mtlli rtflaces t)» 341 ner j m r» sisreii ori ikIhk Ik 
Mmt* ><«*> Nrr 
- m SB-} su«I) 'plaii it' n mor iista >irii m twduiri iWificnigK ti 



SMtMt drims ar; nniikli iw IS Ca. aS •». «4 )N»2. 




EXPANSION 




Tired of trying to run your word processor or your DMB on an 
OSI 64 character video screen? Now there's the SEB-3, THE 
most versatile 80x24 video board anywhere is available for OSI 
48 pin BUSS systems. No longer will you have to consider con- 
verting your video-based system to a serial terminal because 
you've found 64 characters stifling for serious business use. 
Nor need you give up compatibility with any existing graphics 
software because the SEB-3 allows you to choose ANY screen 
format up to 80x24 including 32x32 and 64x32. Since the 
SEB-3's screen format can be changed at any time under soft- 
ware control, even gaming displays can benefit from screens 
custom tailored to the game itself. The SEB-3 is so 
well designed and so versatile that it will not need 
to be replaced — ever. Simple changes in software and/or 
hardware will allow the SEB-3 to: generate displays up to 256 



columns; handle 50 Hz EuFopear\ formats; accomodate custom 
characters or character cell sizes larger or smaller than 8x8 
and transparently access the screen to eliminate screen 
"glitches". In short, the SEB-3 will meet any demands your 
system may place on it now and in the future. The SEB-3 also 
supports an OSI-style floppy disk interface which can handle 
two 5" or 8" drives. Like all of the boards in the SEB series, 
the SEB-3 simply "plugs in" to your machine — there are 
absolutely NO hardware changes. The SEB-3 is designed to 
replace your outmoded 540 board so you don't even lose a 
backplane slot. Your keyboard input now also plugs into 
the SEB-3 — load one of the software drivers and you're 
ready to go! 
SEB-3 Assembled $259.00 Bare Board $59.00 

KH $220.00 Manual only $5.00 




If your Challenger can't generate displays like those shown 
above WHAT ARE YOU WAITING FOR? The SEB-1 High 
Resolution Graphics and Memory Board (for 01 P and 
Superboard II) and the SEB-2 High Resolution Graphics and 
Disk Controller Board (for C2/4/8) simply 'plug-in' to your 
computer and give you instant access to over 49000 
individually addressable pixels in up to 8 colors! Your Hi-Res 
screen can go from 32 x 16 alphanumerics to 256 x 192 point 
graphics in 1 1 software selectable modes. The standard video 
of your computer is left intact, so that none of your current 
software library is outmoded. Use the graphics for Business, 
Scientific, Education, or Gaming displays that were Impossible 
— until now! SEB-1 SEB-2 



Installation of either board requires absolutely NO modification of 
your computer — they just 'plug-in'. Nor do they preclude your 
using any other OSI-compatible hardware or software. In addition 
to the Hi-Res Graphics the SEB-1 gives 01 & Superboard II users 
16K of additional user memory (over and above that memory 
devoted to the graphics), two 1 6 bit timers/ counters, an on-board 
RF modulator, and a parallel port with handshaking. The SEB-2 
gives OSI 48-pin BUS users an OSI hardware/software 
compatible Disk controller, and an RF modulator that can be 
user-populated. 

FOR OSI IP, 2-4P, 2-8P, C4P, C8P 



SEB-1 



SEB-2 



Assembled and Tested 
Kit 



$249.00 (5K RAM) $239.00 (1 K RAM) 
$165.00 (No RAM) $199.00 (No ^AM) 



COMING: SEB.3 80 x24 VldeolDisk Controller (C2IAIS), SEB-A ASK Memory 
RAMIROM (C2IAI8), SEB-5 8K RAUIDisklSoundlClocklVoice (CI & Superboard). 



Write for FREE catalog 

International Requests please 

supply 2 international Response Coupons 



ORION 



Bare Board & Manual 
Manual only 


$ 59.00 
$ 5.00 


$ 59.00 
$ 5.00 


k 




VISA' 

-762-5636 


j 

'^SOFTWARE ASSOC. 


w 


P.O. BOX 310, OSSINING, NY 1056 


2 914 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



BASIC Macro Function 
for Cursor Control 



by Kerry Lourash 



BASIC Macro is a machine- 
language program similar in 
function to the macro option of 
some assemblers. It enables 
Cursor Control users to insert 
often-used statements with only 
two Iceys when typing BASIC 
programs. ERGO, a routine for 
all C1P users, eliminates the 
graphic character in error 
messages. 

BASIC IMacro and 
ERGO 

require: 

OSI C1P 

As a C IP owner, I type in a lot of BASIC 
programs, mainly because neither OSI 
nor independent vendors have the pro- 
grams I want. While I pounded my 
fingers to the bone and cursed my two- 
fingered typing speed, I wished for a 
utility similar to the macro function of 
some assemblers. After punching out 
"GOSUB8000:GOTO650" for the 20th 
time in a program, I was inspired to 
write BASIC Macro. 

Macro is an extension of the Cursor 
Control program (MICRO 36:75). It 
lets you insert one of ten macros up to 
70 characters long in a BASIC line with 
only two keystrokes (three, if you 
count CTRL R as two keys) . If a phrase 
(such as GOSUB8000:GOTO650) oc- 
curs frequently in a program you're typ- 
ing, store it in a BASIC line 0-9 (1 
GOSUB8000:GOTO650|. Now, as you 
encounter that phrase, hit CTRL R. A 
white block will appear. Type '1' and 
the phrase will be printed on the screen 
and stored in the input buffer. Should 
you type a line number that doesn't 
exist. Macro will wait for another 
number. If you type a letter. Macro 
assumes you've changed your mind 
about calling a macro, and exits. CTRL 
R stands for repeat. 



When designing Macro, I had plans 
for a sophisticated phrase storage area 
with variable-length storage space. 
After I'd written the code to find and 
print the phrases, which was the lesser 
half of the program, I found that I'd 
used over half a page of memory. This 
approach was going to cost me well 
over the page of memory I had allotted 
for program and storage space! So I let 
BASIC keep track of the phrases. 

To patch Macro into Cursor Con- 
trol, change the input routine PATCH 



at location $1E0F to JMP $0222 instead 
of JMP $1E12. 

Macro finds the BASIC line you 
specify, prints it on the screen, and 
stores it in the input buffer. If the addi- 
tion of the phrase makes the line too 
long, the 'BEL' character is printed. To 
use BASIC lines 0-9 as storage space, it 
was necessary to teach Macro how to 
convert tokens to keywords, but the 
final program is still much shorter than 
my first attempt. The WINDUP rou- 
tine finds the buffer count in the stack. 



BASIC Macro Listing 










10 


OOOO 




; BASIC MACRO FOR CC 




20 


0000 




PATCH= 


*lEOf 






30 


0000 




OK- 


*1F1C 






40 


0222 




*- 


$0221 






50 


0222 


C912 


MACRO 


CMP 


*tl2 


;CTRL R? 


60 


0224 


B061 




BNE 


RESUME 




70 


0226 


20101F 




JSR 


OK 


SPRINT WHITE BLOCK 


80 


0229 


2000FD 


MAC 


JSR 


$FDOO 


iGET MACRO NUMBER 


90 


022C 


C93A 




CMP 


**3A 


J IF NOT A NUMBER 


100 


022E 


B057 




BC3 


RESUME 


JTHE'N! EXIT 


110 


0230 


C930 




CMP 


*t30 




120 


0232 


9053 




BCC 


RESUME 




130 


0234 


E930 




SBC 


♦*30 


; ASCI I TO BlNARr 


140 


0236 


8511 




3TA 


$11 


JLOOK FOR LINE « 


150 


0238 


ft?00 




LDA 


*0 




160 


023 A 


3512 




STA 


tl2 




170 


023C 


2032A4 




JSR 


$A432 




180 


023F 


90E8 




BCC 


MAC 


JTRY AGAIN 


1?0 


0241 




f 








200 


0241 


A003 




LDY 


*3 


JTO START OF LINE 


.?10 


0243 


C8 


FQUND 


INY 




,"NEXT CHAR. 


220 


0244 


8497 




STY 


$97 


JSAVE Y REGISTER 


230 


0246 


BIAA 




LDA 


( $AA ) , Y 


rGET CHAR. 


240 


0248 


F035 




BEQ 


UINDUP 


iQUIT IF NULL 


250 


024A 


3007 




BMI 


TOKEN 


i CONVERT IF TOKEN 


260 


024C 


A497 


FND 


LtlY 


$97 


; RESTORE Y REGISTER 


270 


024E 


206F02 




JSR 


STORE 




230 


0251 


DOFO 




BNE 


FOUND 


iBRANCH ALUAY3 


2?0 


0253 




f 








300 


0253 


38 


TOKEN 


SEC 




fFIND & CONVERT TOKEN 


310 


0254 


E97F 




SBC 


*t7F 


; TOKEN MINUS 7F 


320 


0256 


AA 




TAX 




,' TOKEN INDEX IN A REG 


330 


0257 


AOFF 




LDY 


♦tFF 




340 


0259 


CA 


TO 


DEX 






350 


025A 


F008 




BEQ 


T2 


; FOUND TOKEN IN TABLE? 


360 


025C 


C8 


Tl 


INY 




;no, next letter 


370 


025D 


B984A0 




LDA 


*A084,Y 




380 


0260 


lOFA 




BPL 


Tl 


rLOQP S. GET NEXT CHAR. 


3?0 


0262 


30F5 




BMI 


TO 


fLOQP TO NEXT TOKEN 


400 


0264 


C8 


T2 


INY 






410 


0265 


B984A0 




LDA 


*A084,Y 


iGET LETTER 


420 


0268 


30E2 




BMI 


FHD 


,'LAST letter of TOKEN? 


430 


026A 


206F02 




JSR 


STORE 




440 


026II 


D0F5 




BNE 


T2 




450 


026F 




J 








460 


026F 


A60E 


STORE 


LDX 


tOE 


,' STORE CHAR. IN BUFFER 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



19 



where it was stored at the start of the 
INPUT routine |the X register). Loca- 
tion $0E, the screen character counter, 
is loaded into the stack to update the 
buffer count. 

For those unfortunates who have 
not been converted to Cursor Control, I 
whipped up a short patch to the stock 
output routine that prints CIP error 
messages correctly. As the output rou- 
tine prints characters on the screen, 
ERGO checks every carriage return to 
see if it comes from the error message 
routine. If so, ERGO steps in and prints 
the second letter of the error message as 
a letter, not a graphics character. The 
stock carriage return/line feed is omit- 
ted to save space on the screen. To 
patch ERGO into the output routine, 
change the contents of the output vec- 
tor to the start of ERGO ($021A = 22, 
$0218=02). 



You may contact Kerry Lourash at 1220 
North Dennis, Decatur, IL 62522. 



JMCftO 



BASIC Macro Listing (Continued) 










470 0271 E047 




CPX 


»$47 






480 0273 BOOS 




BCS 


STO+1 






490 0275 297F 




AND 


*$7F 


;ZERO 


HI BIT 


500 0277 9513 




STA 


$13, > 






510 0279 2CA907 


STO 


BIT 


»07A» 


;bel 


CHAR. IF >71 


520 027C 4CE5A8 




JMP 


»A8E; 


JPRINT CHAR. 


530 027F 


f 










540 027F BA 


UlNDUP 


TSX 




JUPDATE BUFFER COUNT 


550 0280 A50E 




LDA 


$0E 


.'LINE 


COUNT IN STACK 


560 0282 9D0201 




STA 


$0102. X 




570 0285 A901 




LDA 


tl 


;non- 


PRINTING CHAR. 


580 0287 4C121E 


RESUHE 


JHP 


PATCH+3 JBACK 


TO CC 


ERGO Listing 












10 0000 

20 

30 0222 


i 


ERCO ROUTINE 






»=$0222 










40 0222 C90D 




CMP 




*13 


IS CHAR A CR ? 


50 0224 D015 




BNEEXIT 






60 0226 8650 




STX 




$50 


SAVE X REG. 


70 0228 BA 




TSX 






GET STACK POINTER 


80 0229 BD0501 




LDA 




$105, X 


CALLING ADDRESS $A252? 


90 022C C952 




CMP 




*$52 




100 n2?K D007 




BNE 




NOERH 




no 0230 BD0601 




LDA 




$106, X 




120 


0233 C9A2 






CMP 


«A2 


130 0235 F007 




BEQ 




ERGO 


YES, PRINT ERR MESS. 


140 0237 A650 


NOEHR 


LDX 




$50 


RESTORE AiXREGS. 


150 0239 A90D 




LDA 




*13 




160 023B 4C69FF 

170 

180 023E A650 


EXIT 


JMP 




$FF69 


TO REGULAR OUTPUT 


ERGO 


LDX 




$50 


RESTORE X REG. 


190 0240 20E3A8 




JSR 




$A8E3 


PRINT '?' 


200 0243 BD64A1 




LDA 




$A164,X 


FIND 1ST LETTER 


210 0246 20E5A8 




JSR 




$A8E5 


PRINT IT 


220 003F BD65A1 




LDA 




$A165,X 


FIND 2ND LETTER 


230 024c 2y/F 




AND 




#$7F 


ZERO HI BIT 


240 024E 4C5FA2 




JMP 




$A25F 


TO REG. ERR ROUTINE 



g\ C" I Stankievvicz & Robinson, gt ^ W^ 

1 1 ^^ ■ authors of MINOS. NIGHT RIDER, etc.. ■_ ■ r 

^^"^ ^"^ proudly present to you: ^^^ ^^ 

34 original PROGRAMS on tape all toi^ the unboliovably low price of $29.95!! 



CIP 



ARCADE TYPE 



NIGHT RIDF.K- 
COSMIC DKHRL'- 
MINOS- 

s'i'KEE-T svvi:[-;i^ 
kioce', ckcisl-m-: 
caca:- 

PINH.MJ. 

osi c;ra\[)' 

MlNh: FIKl.l) 

WORM 

DI-PTH CiJARCi 

corcH..\: 




XE 



MINOS (mazf: 




STRATECrY 



KIDCK CKIISKK 

NHSCELLANEOIJS 

XrKSSACK KNCOni- 
lAlMNC TCTOR 
I'HOXK Nl'MHKR 



KALEIDOSCOPIC 



.All progr; 
Many are 



SOFTWARE 



VICTORY SOFTWARE C;ORP 

2027-A S.|. RUSSELL CIRCILE 

ELKINS PARK. PA 19117 

(215) 5-6-.5H2.'; 



20 



MICRO - Tlie 6502/6809 Journal 



No. 55 - December 1982 



NEW FROM D & N MICRO PRODUCTS, INC. 




MICRaSO COMPUTER 



Microsoft 




Basic-80 


$289 


Basic Compiler 


$329 


Fortran-80 


$410 


Cobol-80 


$574 


Macro-80 


$175 


Edit-80 


$105 


MuSimp/MuMath 


$224 


MuLisp-80 


$174 



Z80A CPU with 4MHz clocl< and CP/M 2.2 
operating system. 64K of low power static 
RAM. Calendar real time clock. Centronics 
type parallel printer interface. Serial inter- 
face for terminal communications, dip 
switcfi baud rates of 1 50 to 9600. 4 " cooling 
fan with air intake on back of computer and 
discharge through ventilation in the bot- 
tom. No holes on computer top or side for 
entry of foreign object. Two 8" single or 
double sided floppy disk drives. IBM single 
density 3740 format for 243K of storage on 
each drive. Using double density with IK 
sectors 608K of storage Is available on a 
single sided drive 0( 1.2 meg on a double 
sided drive. Satin finish extruded 

Software available In IBM single density 8" 
Digital Research 

PU1-80 $459 

Mac $ 85 

Sid $ 78 

Z-Sid $ 95 

CBasic-2 $110 

Tex $ 90 

DeSpool $ 50 
Ashton-Tate 

dBase II $595 



aluminum with vinyl woodgrain decorative 
finish. 8 slot backplane for expansion. 48 
pin buss is compatible with most OSI 
boards. Uses all standard IBM format CP/M 
software. 

Model 80-1200 $2995 

2 8" single sided drives, 1.2 meg of 
storage 
Model 80-2400 $3495 

2 8' double sided drives, 2.4 meg of 

storage 
Option 001 $ 95 

Serial printer port, dip switch baud rate 

settings 

fomiat. 

MIcropro 

Wordstar $299 

Mall-Merge $109 

Spellstar $175 

SuperSortI $195 
Pascal 

Pascal/MT-i- $429 

Pascal Z $349 

Pascal M $355 



Convert almost any static memory OSI machine to CP/M® with the D & N-80 CPU Board. 



Z80A CPU with 4MHz clock. 2716 EPROM 
with monitor and bootstrap loader. RS-232 
serial interface for terminal communica- 
tions or use as a serial printer interface in a 
VIDEO system. Disk controller Is an Intel 
8272 chip to provide single or double densi- 
ty disk format. 243K single density or 608K 
double density of disk storage on a single 
sided 8' drive. A double sided drive pro- 
vides 1.2 meg of storage. DMA used with 
disk controller to unload CPU during block 
transfers from the disk drives. Optional 
Centronics type parallel printer port com- 



plete with 10 ft. cable. Optional Real Time 

Calendar Clock may be set or read using 

'CALL' function in high level languages. 

Power requirements are only 5 volts at 1.4 

amps. Available with WORDSTAR for serial 

terminal systems. 
INCLUDES CPM 2.2 

D & N-80 serial $695 

D & N-80 serial w/Wordstar $870 

D & N-80 video $695 

OptionOOl $ 80 

parallel printer and real time 

calendar clock 




D & N-80 CPU BOARD 



OTHER OSI COMPATIBLE HARDWARE 



I0-CA1 ox Serial Printer Perl $125 

Compatible with OS-65U and OS-65D soft- 
ware 

I0-CA9 Parallel Printer Port $175 

Centronics standard parallel printer inter- 
face with 10 ft. flat cable 
BP-580 8 Slot Backplane $ 47 

Assembled 8 slot backplane for OSI 48 pin 
buss 

24MEM-CM9 $380 24MEM-CM9F $530 
ieMEM-CM9 $300 16MEM-CM9F $450 
8MEM-CM9 $210 8MEM-CM9F $360 
BMEM-CM9F $ 50 FL470 $180 

24K memory/floppy controller card sup- 
ports up to 24K of 2114 memory chips and 
an OSI type floppy disk controller. 
Available fully assembled and tested with 
8, 16, or 24K of memory, with floppy con- 
troller (F). Controller supports 2 drives. 
Needs separated clock and data inputs. 
Available Bare (BMEM-CM9F) or controller 
only (FL-470). Ideal way to upgrade 
cassette based system 



CI P-EXP Expansion Interface $ 65 

Expansion for 01 P 600 or 610 board to the 
OSI 48 pin buss. Requires one slot in 
backplane. Use with BP-580 backplane 
BIO-1600 Bare 10 card $ 50 

Supports 8K of memory, 2 16 bit parallel 
ports may be used as printer interfaces. 5 
RS-232 serial ports, with manual and Molex 
connectors 

DSK-SW Disk Switch $ 29 

Extends life of drive and media. Shuts off 
minifloppy spindle motor when system is 
not accessing the drive. Complete KIT and 
manual 

D & N Micro Products, Inc 

3684 N. Wells St. 

Fort Wayne, Ind. 46808 

(219)485^14 






TERMS $2.50 shipping, Foreign orders add 15%. 
Indiana residents add 4% sales tax. 



Disk Drives and Cables 
8'ShuganSA801singlesided $395 

8 ' Shugart SA851 dou ble sided $585 

FLC-66ft.cablefromD&NorOSI $ 69 

controller to 8" disk drive 
5 1/4 'MPIB51 with cable, power $450 

supply and cabinet 
FLC-51/48ft.cableforconnection $ 75 

to 5 1/4 drive and D & N or OSI 

controller, with data separator and 

disk switch 
Okidata Mlcrollne Printers 
M L 82A Dot Matrix Printer $534 

120 OPS, 80/120 columns, 9.5" paper width, 
friction or pin feed 

ML 83A Same as 82A except $895 

16' paper width, 132/232 columns with 
tractor feed 

ML84Sameas82Aexcept200CPS, $1152 
16' paper width, 132/232 columns, 2K buf- 
fer, dot addressable graphics, with tractor 
feed 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



21 



ATARI Character Graphics 
from BASIC, Part 3 



by Paul Swanson 



You can remove the screen 
flicker by adding a short 
machine-language program to 
Atari's vertical blanlt interrupt 
routine. 

Character Graphics 

requires: 

Atari 400/800 

Last month I explained how to enable 
and use Atari's fine scrolling function 
(:). The only big problem was that the 
screen flickered a little because you had 
to shut off ANTIC, along with the dis- 
play, in order to alter the horizontal 
scroll register. 

There are several registers like that — 
you can't write to them while ANTIC 
is displaying a screen or you get strange 
effects. Most of these are taken care of 
by shadowing. However, the horizontal 
scroll register is not shadowed, so we 
need a different technique. 

Shadowing 

Shadowing is a method of updating 
video-related registers without inter- 
rupting the display in progress. Certain 
memory locations ("shadow" registers) 
are set aside to represent the actual 
video registers. When ANTIC com- 
pletes the job of displaying one screen, 
it sends an interrupt signal to the 6502. 
Since ANTIC is not doing anything but 
waiting for the electron beam to return 
to the upper left comer of the screen, 
the 6502 has time to execute many in- 
structions. Among the things accom- 
plished during this vertical blank 
period is an update of the actual video 
registers from the contents of the 
shadow reigsters. This guarantees that 
all of the hardware registers are written 
while ANTIC is not drawing on the 
screen. At the end of the interrupt rou- 
tine, the 6502 automatically returns to 
whatever it was doing before the inter- 
rupt occurred, so this process is almost 
invisible to the main program. This in- 



terrupt routine happens at the end of 
every sweep of the electron beam, or 
exactly sixty times per second. 

The Vertical Blank Interrupt 
Routine 

Every sixtieth of a second your pro- 
gram, whether in BASIC or machine 
language, gets interrupted for this 
special routine. Actually, there are two 
routines. The first one, which almost 
always runs, is called the immediate 
vertical blank interrupt routine. It 
takes care of all of the timers in the 
system, which includes the real time 
clock in locations 18 through 20 



Listing 1: Routine to shadow the fine 
scrolling registers. The JMP location 
xxxx will be the vector value at location 
$224. The shadow registers will be at 
locations $610 and $611. 



0600 


AD 


11 


06 


LDA 


«611 


0603 


8D 


05 


D4 


STA 


«D405 


0606 


AD 


10 


06 


LDA 


«610 


0609 


aD 


04 


D4 


STA 


«D404 


060C 


AC 


>;;; 


>: ;■: 


JMP 


*>;>;>:>; 



[decimal). It adds one each frame so 
that PEEK(20)-i-PEEK(19)*256-i-PEEK 
(18)* 65536 always reveals the elapsed 
time in sixtieths of a second. 

The second routine is tacked on to 
the end of the first one. This second 
part is called the deferred vertical blank 
interrupt routine. You can easily stop 
this routine from running by setting 
the critical flag (a 1 into location 66). In 
addition to writing the shadowed infor- 
mation to the hardware registers, this 
second part also updates a few other 
timers, maintains the keyboard auto- 
repeat and debounce functions, and 
reads and interprets the game con- 
trollers into special memory locations. 

By altering two vector locations, you 
can replace or add to the existing inter- 
rupt routines. Each vector is a two-byte 
address stored in low, high order. 

The vertical blank interrupt starts 
with a signal generated by ANTIC at 
the end of the display. This signal can 
be masked by the hardware register 
NMIEN (decimal location 54286). If 
the contents last written here were 64, 



Listing 2 



Set 



»»* Custom Character 

«** Vertical Blank 

ttt Interrupt routine 



6 

7 

8 

9 

10 

20 

30 

40 

47 

48 

4<? 

50 

60 

70 

77 

78 

79 

80 
<?0 
100 



ttt Program by. - - 
*«* Paul S. 



Swanson 



ttt 
ttt 

ttt 

ttt 
ttt 



REM 

REM 

REM 

REM 

REM 

REM- 

REM 

REM 

REM Calc. position in fliem. 

DIM S«(1024) 

A=ADR(S*) 

B=INT (A/512+1 )t2 

CBASE=Bt25A-ft+ 1 

REM 

REM 

REM Clear S string 

S«(1)=CHR«(0) 

S«(1024)=CHR*(0) 

S«(2)=S«'.l) 

REM 

REM 

REM Move standard set down 

FOR 1=0 TO 511 

S* (CBASE+I , CBASE+I ) =CHR« (PEEK ( 1+57344) ) 
NEXT I 



107 REM 

108 REM 



(continued) 



22 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Listing 2 (continued) 



109 REM Set # to character 

110 FDR 1=24 TO 31 
120 READ N 

130 S$ (I+CBASE, I+CBASE)=CHR«(N) 
140 NEXT I 
147 REM 
143 REM 

14? REM GR.2 - No te;;t window 

150 GRAPHICS 18 
152 GOSUB 500 

157 REM 

158 REM 

159 REM Find Display List 

1 60 DL I ST=PEEK ( 560 ) +PEEK < 561 ) «256 

162 SL0C=PEEK(DLIST+4)+PEEK(DLIST+5)«256 

167 REM 

168 REM 

169 REM Set scroll enables 

170 POKE DLIST+3,PEEK'.DLIST+3)+4a 
ISO FOR 1=6 TO 16 

190 POKE DLIST+I,PEEK;DLIST+I)+4S 
200 NEXT I 
207 REM 
203 REM 

209 REM Initialize position 

210 VPDS=96 
220 HP0S=80 
222 POKE 756, B 
224 WING=1 

226 S=14 

227 REM 

228 REM 

229 REM Draw character in position 

230 V=INT (VPOS/16) 

232 IF WING=1 THEN SOUND 0,10,0,6 

240 VSCR0L=VP0S-V*16 

250 H=INT (HPOS/8) 

260 HSCR0L=HP0S-H«8 

262 IF WING=1 THEN WING=2: S* (CBASE+25, CBASE+25) =CHR« <0) : S« 

(CBASE+26,CBASE+2ib)=CHR«(231) : GOTO 266 

264 WIN6=1 :S*(CBASE+25,CBASE+25)=CHR*!195) : S* (CBASE+26, CBASE+26) 

=CHR«'.36) 

266 P1=V«24+H 

270 IF POPl THEN POKE SLOC+P.O 

280 POKE 1552,HSCR0L 

290 POKE 1553, 15-VSCROL 

291 IF POPl THEN P=P1:F0R 1 = 1 TO 3:NEXT I 

292 POKE SL0C+P,3 
294 SOUND 0,10,0,2 

297 REM 

298 REM 

299 REM Read Joystick 

300 OLDS=S:S=STICK(0) 
310 IF S=15 THEN S=OLDS 
320 VMOVE=0 

330 HMOVE=0 

340 IF S=9 OR S=13 OR S=5 THEN VMaVE=2 

350 IF S=10 OR S=14 OR S=6 THEN VM0VE=-2 

360 IF S>4 AND S<3 THEN HM0VE=1 

370 IF S>8 AND S<12 THEN HKOVE=-l 

380 IF VM0yE+VPQS>=0 AND VM0VE+VP0S< 191 THEN VP0S=VP0S+VM0VE 

390 IF HM0VE+HP0S>=0 AND HM0VE+HP0S< 192 THEN HP0S=HP0S+HM0VE 

400 IF VM0VE=2 THEN WIN6=2 

410 GOTO 230 

497 REM 

498 REM 

499 REM SET UP VBLANK ROUTINE 

500 FOR 1=1 TO 13 
510 READ N 

520 POKE 1535+1,N 

530 NEXT I 

540 POKE 66, 1 

550 POKE 1 549, PEEK < 548) 

560 POKE 1550, PEEK (549) 

570 POKE 548,0 

580 POKE 549,6 

590 POKE 66,0 

600 RETURN 

1000 DATA 0,195,36,24,24,36,0,0 

1010 DATA 173,17,6,141,5,212,173,16,6,141,4,212,76 



the interruipt will happen. Writing a 
zero will prevent the interrupt. 

If the signal is not masked by 
NMIEN, the 6502 is interrupted and a 
branch to the immediate vertical blank 
interrupt routine occurs. This updates 
the real time clock, processes the at- 
tract mode, and maintains a special 
system timer, CDTMVl (refer to Atari 
manuals). 

When the immediate mode vertical 
blank routine is completed, the flag 
CRITIC (memory location 66) is 
checked, as is the processor interrupt 
bit I. If either is non-zero, the interrupt 
sequence is terminated with a return to 
the main program 6502 instruction 
RTI. Otherwise, the interrupt routine 
continues with the deferred portion. 

This second part moves all the 
shadow registers into the hardware 
registers, updates a few other system 
timers, and decodes the results read 
from the game controllers. When it has 
finished, it branches through the vector 
at location 548 (decimal — 2 bytes]. 
Unless you alter it, this location points 
to an RTI routine. 

Every time there is a vertical blank 
interrupt, the computer uses the ad- 
dress at location 546 to find the im- 
mediate vertical blank interrupt rou- 
tine. It uses the address at location 548 
only when the critical flag and the I bit 
are not set. BASIC cannot access the I 
bit directly, but it can write to the 
critical flag with a POKE. 

Your Own Routine 

To shadow your fine scrolling 
values so that you don't interrupt the 
screen while it is being drawn, you 
must add on your own machine-lan- 
guage routine. This can be done by 
altering the pair of memory locations 
called VVBLKD (Vector for Vertical 
BLanK Deferred routine — this is the 
one at location 548). 

First you must write your routine in 
machine language and store it in a fixed 
place in memory. In the sample pro- 
gram, the routine requires 15 bytes and 
starts at location $600 (1536 in 
decimal). A BASIC POKE routine may 
be used to install this code. 

Since BASIC is so slow, you must 
make allowances for certain odd occur- 
rences. What happens if a vertical 
blank routine tries to use a vector be- 
tween the time you write one byte and 
the time you write the next byte? Your 
program crashes! To get around this 
potential catastrophe, you can shut the 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



23 



second part of the vertical blank inter- 
rupt routine off so that it does not even 
look at this vector. This is accomplished 
by setting the critical flag (a 1 into loca- 
tion 66) . You then make the changes to 
the vector at location 548, then restore 
the critical flag with a zero into loca- 
tion 66. This needs to be done only 
once — while you change the contents 
of the vector. 

If you want to add to the beginning 
of the immediate vertical blank inter- 
rupt, first POKE 54286 (NMIEN) with a 
zero. This disables the vertical blank 
interrupt. Next, make the appropriate 
changes to the vector at 546, and then 
POKE 54286 with a 64 to re-enable the 
vertical blank interrupt. 

Listing 1 shows the routine used to 
form shadow registers for the fine 
scrolling hardware registers. You must 
POKE the first 13 bytes into memory, 
then copy locations 548 and 549 into 
bytes 14 and 15. This causes the rou- 
tine to jump to the location that the 
vertical blank interrupt routine nor- 
mally jumps to on completion. To get 



the normal interrupt routine to jump to 
your routine in the first place, POKE a 
zero in location 548 and a 6 in location 
549. This puts 1536 ($600) into the 
VVBLKD locations. 

The machine-language program 
takes the values in locations $610 and 
$611 [decimal 1552 and 1553) and 
stores them into the horizontal and ver- 
tical scroll hardware registers. Then it 
jumps back into the vertical blank in- 
terrupt routine where we first inter- 
rupted it. Locations 1552 and 1553 
(decimal) now act as shadow registers 
for horizontal and vertical scroll 
values, respectively. 

The BASIC Program 

Listing 2 enhances the program 
presented in last month's article by ad- 
ding the shadowing routine. The 
machine-language routine is coirverted 
to decimal and included as line 1010 in 
a DATA statement. A new subroutine, 
called at line 152, has been added at 
line 500. It first READS the machine- 
language routine into the locations 



chosen. Line 540 turns off the deferred 
vertical blank interrupt routine so that 
the coimputer will not try to branch 
through the vector that needs changing. 
Lines 550 and 560 copy the current con- 
tents of that vector into the JMP in- 
struction of our machine-language rou- 
tine and then change the vector to 
point to location $600 (1536 decimal). 
Line 590 turns off the flag, enabling the 
new routine, and RETURNS. 

Note that the second DATA state- 
ment READ happens after the READ for 
the first one. If you rearrange the pro- 
gram, make sure you pay attention to 
the DATA pointer so that you don't in- 
sert the shape of the bird where the 
machine-language routine should go. 

There are a few other changes made 
to the portion that scrolls the bird. 
Lines 266 through 292 are altered. Line 
266 now calculates the new position. If 
it is the same as the old position except 
for the scrolling values, the character is 
not erased. It is erased only when the 
position value has changed; this limits 
the flickering substantially. 



maxell 




the top of the line 
in floppy diskettes 



Write for free catalog with more than 400 fantast 
values for all your word and data processing need 
Outside USA. enclose $1.00 . 

ABM PRODUCTS 

8868 CLAIREMONT MESA BLVD. 
SAN DIEGO, CALIFORNIA 92123 

Toll Free 800-854-1555 Orders Only 

For information or California Orders 

(714)268-3537 



"INTERESTING SOFTWARE" 
8781 Troy St. • Spring Valley, CA92077 

(619) 466-2200 



WORLD ALPHABETS 



Jl f -^-Ml:-? 


rJt -Jii:' ■-'l:L-.:i-^- 


U - 


|o... 


H ■-; H r 


■:■.. c{ ,j c\ d i y 


'd r 


■:i-| 


Main i5HflT 


b b ;; H M a >i n Hi e H w u i , 







Ten type fonts allow user to create text or use pro- 
nunciation tables in Arabic, Cherokee Indian, 
Hieroglyphics, Greek, Hebrew, Japanese, Rus- 
sian, Sanskrit or Roman. Author; VJ.C. Jones 



Diskette 



$89.95 



BASIC LEARNING 
PACKAGE 

An introduction to the Apple II or II Plus Computer. 
Teaches beginner to program in BASIC. Author: J.J, 
Sudikatus 



Diskette 



$49.95 



Both require an Apple II with Applesoft, 48K, plus disk 
drive. Epsom printer with Graftrax is optional. 

Apple II Of II Plus and Applesoft are Irademorks of Apple Computer, Inc. 



24 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Lines 550 and 560 are altered to 
POKE into the new shadow registers. 
ANTIC is not turned off at all. Line 291 
is added to update the position value P 
and cause a slight delay if the position 
value were changed. This delay guaran- 
tees that there has been at least one ver- 
tical blank interrupt routine since the 
new values were vsrritten to the shadow 
registers. The hardware registers are 
updated before line 292 is executed. 
Line 292 puts the bird on the screen in 
the position indicated by P. If the posi- 
tion were not altered, this line doesn't 
actually do anything. If the position 
value has been changed, it draws the 
bird in the new position. 

There is still a slight flicker every 
once in awhile, but this will not be 
noticeable if other things are happening 
at the same time. The only way to 
eliminate the flicker altogether is to 
use machine language to update the 
bird as well. By using shadow registers 
you could write a vertical blank inter- 
rupt routine that would take your posi- 
tion values and reduce them to the 



screen position and the fine scrolling 
values. BASIC is a much easier lan- 
guage in which to create programs, but 
a little machine language now and then 
can help smooth out the rough edges. If 
you can get away with routines as short 
as the one in listing 1, it is certainly 
worth it. 

What To Do With This Information 

The character graphics example 
here was intended for instruction only. 
However, the shadowing described in 
this article, combined with the custom 
character set and fine scrolling describ- 
ed in parts 1 and 2, needs only to be 
combined with a little imagination to 
produce some elegant software. 



Paul Swanson is our Atari columnist. You 
may contact him at 97 Jackson Street, 
Cambridge, MA 02140. 



iMCftO 



IMCRO 

is publishing 
an OSI bool(! 



OSI users will be getting a book of 
their own. Early in 1983, MICRO 
magazine plans to publish a strictly 
OSI volume! 

We will include a variety of topics — 
BASIC Enhancements, Machine- 
Language Aids, Hardware, i/0 
Enhancements, and a "What's 
Where in the OSI" reference 
guide. We'll supply more details 
soon. 

Let us know what you would like to 
see in this book. Or, if you've written 
an article/program that you think 
should be a part of this volume, 
send it in now! 



UPGRADE YOUR AIM-65* INSTANTLY 



'A trademark of Rockwell Inc. 



To A 6809 Development System 

With The 

"MACH-9" 

From 

M M S Inc. 




INTRODUCTORY PRICE 

$239. 

Plus $6 U.P.S. 
And Handling 



Includes: 

*6809 CPU Plug-in Assembly 
'Super-set of AIM Monitor 
*Two-Pass Symbolic Assembler 
'Complete Monitor Source Listings 
'Enhanced Cut & Paste Editor 
'200 Page Manual 
'Full I/O Control 



"MACH-9" is assembled and tested with 
local BUS, 5 locking low force ROM sockets 
and 2K Static RAM 

M M S Inc. 

1110 E. Pennsylvania St. 

Tucson, AZ 85714 

(602) 746-0418 




ViSA- 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



25 



APPLESOFT GOTO/GOSUB 
Checking Routine 



by Peter J. G. Meyer 



This 194-byte machine-language 
routine will check all GOTO and 
GOSUB references in an 
Applesoft program and display 
any that refer to non-existent 
lines. The source program also 
demonstrates how to make use 
of the machine-language 
subroutines available in the 
Applesoft Interpreter. 

GOTO/GOSUB Checker 

requires: 

Apple II with Applesoft 

In a previous article (MICRO 43:101) I 
presented a short assembly-language 
program for a utility that would display 
the bytes constituting a specified line 
in an Applesoft program. That utility 
was constructed using eight machine- 
language subroutines available in the 
Applesoft Interpreter and the Apple 
Monitor. 

In this article I will use two of those 
routines (LINGET and FNDLIN) 
together with six others to construct a 
utility for checking the GOTO and 
GOSUB references in an Applesoft pro- 
gram. This utility does the useful task 
of going through an Applesoft program 
looking for GOTOs and GOSUBs. 
When it finds one, it searches the pro- 
gram for the referenced line. If the line 
does not exist, it displays the offending 
statement with the line number in 
which it occurs. 

To understand the assembly-lan- 
guage program presented here, it is 
necessary only to understand the struc- 
ture of an Applesoft line in RAM and 
the function of the eight Applesoft 
subroutines that are employed. Of 
course, it also helps to know a little 
about 6502 assembly-language pro- 
gramming, but novices should not be 
deterred. 

An Applesoft program line, as it 



26 



exists as bytes in RAM, consists of four 
consecutive parts: 

1. Two bytes containing the address of 
the following line (low byte then 
high byte, as usual). 

2. Two bytes containing the line num- 
ber in hexadecimal. 

3. The tokenized text of the line (in 
which, for example, GOTO is 
represented by the token byte $AB). 

4. The end-of-line token, $00. 

The text of the line may consist of 
several statements. In this case each 
statement (except the last) is followed 
by the end-of-statement token, $3A 
(which is the byte used as the ASCII 
representation of the colon, ':'). The 



final statement in the line is followed, 
not by an end-of-statement token, but 
by the end-of-line token. 

For example, suppose the program 
line "10 IF A = THEN GOSUB 120: 
ON B GOTO 340,560" is the first in a 
progiram. It will (normally) occur at 
$0801 and be represented in RAM as 
shown in figure 1 . 

Good programming style is simply 
knowing what you want to do, and 
stating clearly how to do it. In this 
case, what we want to do is as follows. 
For each line in the Applesoft program: 
1. Inspect the line for GOTOs ($AB 

tokens), THENs ($C4 tokens), and 

GOSUBs ($B0 tokens). 



Figure 1 






801 - lA 08 




pointer to next line 


803 - OA 00 




"10" in hexadecimal 


805 - AD 41 DO 30 


"IF A = 1" 


809 - C4 BO 31 32 30 3A "THEN GOSUB 120:" 


80F - B4 42 AB 33 34 30 2C 35 36 30 "ON B GOTO 340,560" 


819 - 00 




end-of-line token 




Listing 1 








2 


***************************************** 




3 
4 
5 
6 

7 

a 

9 
10 


* UaiU/GOSUB CHHZKER 




* By f Ul'blK MEYER 




* APRIL 1982 

* 




***************************************** 




11 






12 


* RPPI£SOFT SUBPOOTT^TOS 




13 






14 C 


HRSET EPZ $B1 




15 C 


HBGOT EPZ $B7 




16 1 


HDUM D3U $D61A 




17 ; 


nXTPT roU $D697 




18 ) 


JNCST D3U $EAOC 




19 C 


:H!DO B3U SCRFB 




20 


3TO3OT EOT $DB3A 




21 


LZNPKr D3U $ED24 




22 


■* SiaNCARD ZERO PAca! TrTATIONS 




23 






24 


LINNUM EPZ $50 




25 


IXrVAB EPZ $67 




26 


nCIPTR EPZ $B8 




27 






28 


•* SPECIAL ZERO PiNSE DXATICNS 




29 






30 


ICKQ) EPZ $F9 


MICRO - The 6502/6f 


J09 Journal No. 55 - December 1982 



2. If none are found, continue with the 
next line, until the end of the pro- 
gram is reached. 

3. If a GOTO, THEN, or GOSUB token 
is found, read the line number 
following the token. 

4. Search through the program for a 
line so numbered. 

5. If the line is found, continue inspect- 
ing the current line for GOTOs, 
THENs, and GOSUBs. 

6. If no such line is found, report this 
fact by displaying the current line 
number and the offending GOTO, 
THEN, or GOSUB statement (then 
continue the inspection]. 

To go through RAM one byte at a 
time, Applesoft has the subroutine 
CHRGET, which i^ located on page 
zero (at $B 1 ] . This routine makes use of 
the two-byte pointer called TXTPTR 
(at $B8,B9). TXTPTR is usually point- 
ing to a byte somewhere in the Apple- 
soft program in RAM. The effect of 
CHRGET is to advance TXTPTR to the 
next byte and to load that byte into the 
accumulator (setting certain flags along 
the way) . Thus, by repeatedly invoking 
CHRGET we can go through each pro- 
gram line looking for GOTO and 
GOSUB tokens. (CHRGOT, at $B7, is 
CHRGET without the initial advance 
of TXTPTR. It simply loads the 
accumulator with whatever byte 
TXTPTR is pointing to.) 

Having found a GOTO, THEN, or a 
GOSUB token, we can then use the 
subroutine LINGET (at $DAOC) to read 
the line number and place it (in hex- 
adecimal form) in the zero-page loca- 
tion LINNUM ($50,51). We can use 
LINGET for this purpose because this is 
precisely what LINGET was designed 
to do. 

To help you search through a pro- 
gram to find a line whose number is at 
LINNUM, there is- the routine FNDLIN 
(at $D61A). When this routine returns, 
the carry flag is set if such a line was 
found, otherwise the carry flag is clear. 
In the latter case we procede using 
CHRGET to look for harther GOTOs 
and GOSUBs. 

If FNDLIN returns with the carry 
flag set, then we have found a reference 
to a non-existent line and a report to 
this effect is in order. This report only 
needs to consist of 1 . the number of the 
line containing the offending state- 
ment, 2. the word GOTO, THEN, or 
GOSUB, followed by 3. the number of 
the non-existent line referred to. 

For printing numbers we have the 



Listing 1 (con 


tinned) 








31 


LNl 


EPZ 5FA 






32 


IN2 


EPZ 5PC 






33 










34 


;* OTHER TOCATIONS 






35 










36 


DOS'VB 


EOT 53D0 


;D0S WAIW ST5\BT VUCIDR 




37 
38 
39 
40 
41 


SPEAKER 


ECU SC030 






.***********************innnnnnnn,i,-tin,-tin,i,t 






ORG 5300 


;0R )«m«ERE OONVENIENT 


0300 


42 


BEGIN: 






0300 20 FB DA 


43 




JSR emu 


; PRINT <CR> 


0303 


44 


iSET TOTPTR TO BOTE PRECEEDING LIHK FIEU3 OF FIRST LINE 


0303 20 97 D6 


45 




JSR SDCIPT 




0306 


46 


NBCTLINE: 




0306 20 Bl 00 


47 




JSR CHKET 




0309 AO 01 


48 




UK #1 


;END-OP-PROGRAM DOUBLE 00 


030B Bl BB 


49 




LDA (TXTPTR) ,Y 


•RE«HED YET? 


030D DO 06 


50 




BNE SAVLINNO 


•IF NOT 


030F 20 FB DA 


51 




JSR CRDO 


■PRINT FINAL <CR> 


0312 4C DO 03 


52 




JMP DOS'VB 


BACT: To BASIC 


0315 


53 


SAVLINNO: 




0315 


54 


;IN CASE WE NEED TO PRINT IT LATER 


0315 C8 


55 




iNvr 




0316 Bl B8 


56 




LDA (TXTPTR) ,Y 




0318 85 FA 


57 




STA INl 




031AC8 


58 




INY 




031B Bl B8 


59 




I£IA (TX1PTR),Y 




031D 85 FB 


60 




STA UJl+l 




031F 


61 


;ADVAICE TXTPTR TO FIRST BOTE 


IN TEXT OF LINE 


031F A5 B8 


62 




LDA 'IX'IPTR 




0321 18 


63 




or 




0322 69 03 


64 




ADC #3 




0324 85 B8 


65 




STA TXTPTR 




0326 90 02 


66 




BCE QOTHRUUJ 




0328 E6 B9 


67 




im 'IXT'PTR+l 




032A 


68 


GOTHRUIN 


: 




032A 


69 


rlNSPECTING EACH BOTE IN TURN 




032A 20 Bl 00 


70 




JSR CHRtaJi' 




032D C9 00 


71 




CMP #0 ; 


END-OP-LINE TOKEN? 


032F FO 05 


72 




BQ3 NEXTLINE 


IF SO 


0331 C9 C4 


73 




CMP #SC4 ; 


'THEN' TOKEN 


0333 DO OF 


74 




ajE NEXT 




0335 AO 01 


75 




UK #1 




0337 Bl B8 


76 




LDA (TXTPTR) ,Y 




0339 38 


77 




SBC 




033A E9 30 


78 




SBC #530 




033C C9 OA 


79 




CMP #50A 




033E BO EA 


80 




BCS QOTHRUIN 




0340 A9 C4 


81 




LDA #5C4 


'THIN' TOKEN 


0342 DO 08 


82 




ajE STORE ; 


AIWKre 


0344 C9 AB 


83 


NEXT 


CMP #5AB ; 


^^iJ\a^ TOKEN 


0346 FO 04 


84 




BED S-IURE 




0348 C9 BO 


85 




CMP #5B0 ; 


'GOEiUB' TCKEN 


034A DO DE 


86 




ENE QOTHRUIN 




034C 85 re 


87 


STORE 


STA 'JUKhN 




034E 


83 


READUJND 


: 




034E 20 Bl 00 


89 




JSR CHWJKl' 


ADWJCE TXTPTR TO LINE NO. 


0351 20 OC DA 


90 




JSR LINGETT 


READ LINE NO. , STORE IN LINNUM 


0354 A5 50 


91 




LDA LINNUM 




0356 A4 51 


92 




UK UNNUW-l 




0358 85 PC 


93 




STA IN2 


SAVli: LINNUM IN IN2 


035A 84 TO 


94 




STY IN2+1 




035C AD 30 CO 


95 




LDA SPEAKER 


EKH CLICK MEANS A PROG SEARCH 


035F 20 lA D6 


96 




JSR ENDLIN 


SEAI«H PR0C3WM EOR A LINE 


0362 BO 30 


97 




BCS OBCCCMMA 


IF Um. POUND 


0364 


98 


u^mni 


; 




0364 20 FB DA 


99 




JSR CRDO 


PRINT <CR> 


0367 A5 FB 


100 




LDA im+1 




0369 A6 FA 


101 




UK INI 




036B 20 24 ED 


102 




JSR LINPKT 




036E A5 F9 


103 




LDA TOKiN 




0370 C9 C4 


104 




CMP #5C4 


"W15N' TOKEN 


0372 DO 07 


105 




BNE NEXTl 




0374 A9 B9 


106 




U» #THEN 




0376 AO 03 


107 




UK /THEN 




0378 4C SA 03 


108 




JMP PRINT 




037B C9 BO 


109 


NEXTl 


CMP #5B0 


'G03UB' 


037D FO 07 


110 




BED NE)CT2 




037F A9 A6 


111 




II3A #GOTO 




0381 AO 03 


112 




UK /OUIU 




0383 4C SA 03 


113 




JMP PRINT 




0386 A9 AF 


114 


Ntai'1'2 


LCR #QOSUB 




0388 AO 03 


115 




UK /GUSJUB 




03a 20 3A DB 


116 


PRINT 


JSR STHDOT 


PRIOT CiJlU OR GOSUB 



No. 55 - December 1982 



MICRO - The 6502/6809 Journai 



27 



Applesoft routine LINPRT (at $ED24), 
which prints, in decimal form, the hex- 
adecimal number whose high byte is in 
the accumulator and whose low byte is 
in the X-register. For printing text we 
have the routine STROUT (at $DB3Aj, 
which will print the string pointed to 
by the Y-register (high byte) and the ac- 
cumulator (low byte). (The string must 
be terminated by a $00 or a $22.) 

Thus, Applesoft provides us with all 
the routines we need for the job. With a 
good assembler and some attention to 
detail, these can be put together to pro- 
duce a machine-language routine to 
perform the required task. The source 
program in listing 1 demonstrates how 
this can be done. 

Once assembled and BSAVEd, this 
utility is used as follows: LOAD your 
program into RAM and BRUN- the 
routine or, if it is already installed, 
simply CALL it. Line references in 
ONERR GOTOs and GOSUBs will also 
be checked, as will all line references 
(not just the first) in ON X GOTOs and 
GOSUBs. 



Listing 1 (continued^ 








038D AS TO 


117 




U)A IN2-H 


03SF A6 EC 


118 




IXOC IN2 


0391 20 24 ED 


119 




JSR LINPRT r PRINT LINE REFERRED TO 


0394 


120 


CHKCC»« 




0394 


121 


;IN CASE OF MULTIPI£ GCTKJ.OR GOSUB 


0394 20 B7 00 


122 




JSR GHHGOT 


0397 C9 2C 


123 




CMP #$2C 


CCMMA7 


0399 FO B3 


124 




BEQ READUINO 


IF SO 


039B AS B9 


125 




LDA WTPTR+l 


DECREMENT TXTETT^ IN PREP 


039D DO 02 


126 




ENE NEXT3 


FOR NEXT USE OF OTRGE^' 


039F C6 B9 


127 




DEE TXTPTRf 1 


03A1 C6 B8 


128 


NE!n'3 


DEE WTPTR 


03A3 4C 2A 03 


129 




JMP GOIHRUIN 


03A6 
03fl6 


130 
133 








J ***************************** 


03S6 


134 


:* STRINGS 


03A6 20 20 20 


135 


OOTO 


.DA ' GOTO "' 


03A9 47 4F 54 








03m: 4F 20 22 








03AF 20 20 20 


136 


GOSUB 


.DA • GOSUB "' 


03B2 47 4F 53 








03B5 55 42 20 








03B8 22 








03B9 20 20 20 


137 


THQJ 


.DA ' THEN "' 


03H: 54 48 45 








03BF 4E 20 22 








03C2 


138 




END 



Peter Meyer is the author of Agenda Files, 
from Special Delivery Software, and 
Routine Machine, recently released by 
Southwestern Data Systems. He is 
currently designing applications software 



in Europe. You may contact him at 55 
Sutter St., Suite 608, San Francisco, CA 
94104. 

ilMCftO 



*••••••••••••••••••••••••* 




* from 



+ POWER 
COMPUTECH 



Check the 
outstanding 
documenta- 
tion supplied 
with AIM65! 



Top quality power supply designed to Rockwell's specs for fully 
populated AIM65 — includes overvoltage protection, transient sup- 
pression, metal case and power cable: 

PSSBC-A (5V 2A Reg; 24V .5A Avg, 2.5A Peak, Unreg) .... "64.95 
Same but an e^tra AMP at 5 volts to drive your extra boards: 
PSSBC-3 (5V 3A Reg; 24V .5A Avg, 2.5A Peak, Unreg) .... "74.95 
Ttie professional's cfioice in microcomputers: 

AIIVI65/1K RAM "429.95 BASIC (2 ROMS) "59.95 

AIM65/4K RAM "464.95 ASSEMBLER (1 ROM) "32.95 

FORTH (2 ROMS) "59.95. 

SAVE EVEN MORE ON COMBINATIONS 

AIM65/1K-I-PSSBC-A ... "479.95 AIM65/4K-HPSSBC-3 ..."524.95 
We gladly quote on all AIM65/40 and RM65 items as well. 



P.O. 



ORDERS: (714) 369-1084 
Box 20054 • Riverside, CA 92516 



California residents add 6% sales tax 






••••••••••••••••••••••••* 



wm^mmtmwm 



Ver. 2 For your APPLE II/II+ 

The compiete professional software system, that meets 
ALL provisions of the FORTH -79 Standard {adopted Oct. 
1980). Compare the many advanced features of FORTH — 
79 with the FORTH you are now using, or plan to buy! 

FEATURES OURS OTHERS 



79-Standard system gives source portability. YES 

Professionallv written tutorial & user manual 200 PG. 

Screen editor with user-definable controls. YES 

l\/1acro-assembler with local labels. YES 

Virtual memory. YES 

Both 13 & 16-sector format. YES 

Multiple disk drives. YES 

Double-number Standard & String extensions. YES 

Upper/lower case keyboard input. YES 

LO-Res graphics. YES 

80 column display capability YES 

Z-80 CP/M Ver. 2.x & Northstar also available YES 

Affordable! $99.95 

Low cost enhancement option: 

Hi-Res turtle-graphics. YES 

Floating-point mathematics. YES 

Powerful package with own manual , 

50 functions in all, 

AIV1951 1 compatible. 

FORTH-79 V.2 (requires 48K & 1 disk drive) $ 99.95 
ENHANCEMENT PACKAGE FOR V.2 

Floating point & Hi-Res turtle-graphics $ 49.95 

COMBINATION PACKAGE $139.95 
(CA res. add 6% tax; COD accepted)' 



MicroMotion 

12077 Wilshire Blvd. #.506 
L.A.,CA 90025 (213)821^340 
Specify APPLE. CP/M or Norvhstar 
Dealer inquiries invited. 




.28 



MICRO - The 6502/6809 Journal 



No. 55 - December 1962 



Chances are, when you 
bought your first disk drive, it 
was an Apple. Now that you're 
ready for a second, take a look 
at Quentin. 

OurApple*-Mate™ SVa" Disk 
Drive is fully software transparent 
with Apple's DOS 3.3 operating 
systenn in full and half track 
operation. 

Add it to your present drive for 
greater capacity and faster access. 
Just plug it in and go to work. 

And the Apple- Mate has these 
High Performance advantages: 

ON TRACK HEAD SEEK 

A precision lead screw positions 
the head onto the correct track. 
Time-consunning retries and 
disk-to-disk copying errors are 
virtually eliminated. 

SIEMENS^ DISK DRIVE 

The apple-beige unit is built 
around the highly reliable 



Siemens system with over 
10,000 lifetime hours. Shielded 
connecting cable also attached. 

LONG TERM 
DEPENDABILITY 

iVlTBF (Mean Time Between 
Failures) — 8,500 power-on hours, 
and the unit has a one-year 
warranty 

COUNT ON QUENTIN 
FOR QUALITY 

Quentin Research was building 
disk systems for the computer 
industry when Apple was a little 
bud on the big computer tree. 
We're known for product reliabil- 
ity and stand behind every system 
we sell you. 

But the best news may be the 
price— -only $335.00 (40 tracks). 



A special introductory offer 
when you order Apple- Mate 
directly from us. 

So when you're ready to boost 
the juice on your Apple, add-on 
the Quentin Apple-Mate, 

To order: Check, money order, 
Visa or Mastercard number. Calif, 
residents add 6% sales tax. 
Allow one week delivery. 



(QucnTin. 



RESEARCH, INC. 

19355 Business Center Drive 
Northridge, California 91324 
(213)701-1006 



Special 
Introductory 
Price: 
$335.00 



Xf^ 



® Apple is a registered trademark of Apple Computer, Inc. 
tSiemens is a trademark of Siemens Corporation. 
'Apple- Mate is a trademark of Quentin Research, Inc., 
which does not manufacture Apple computers. 



jMcao 

CoCo Bits 



By John Steiner 



This month's CoCo Bits re-examines 
the single disk COPY command. In ad- 
dition, I have noted a few CoCo-related 
news items. One item I did not men- 
tion last month regards the transfer of 
machine-language files to disk. Before 
loading the routines into memory, be 
sure to reserve enough memory space 
so BASIC will not overwrite your pro- 
gram. Also, before loading and ex- 
ecuting the modified BEDLAM from 
disk, a CLEAR 200, 16384 will protect 
the program from BASIC. Without this 
command, the program seems to ex- 
ecute properly but does not print the 
opening message. 

As I mentioned last month, the 
single disk COPY command is avail- 
able and will not destroy a program that 
is in memory (like DSKINI and 
BACKUP). This opens the door to a 
useful routine for selective backup of 
program and data files. The backup 
command is appropriate for archives 
and duplication purposes. COPY is 
useful when only a few files require 
transfer, or if program data must be 
transferred to a disk without destroying 
already existing files. 

If several files must be transferred, 
however, it is tiresome to enter the 
files one by one using COPY 
"filename/ext". The program in 
listing 1 provides a selective backup 
routine. It reads the disk directory 
track and stores all the program names 
in a string array. The array holds up to 
68 file names, the maximum number a 
CoCo disk can hold. After reading the 
filenames, each name is presented. 
Pressing "Y" invokes the COPY com- 
mand and the file is read into memory. 
You are prompted to switch disks, and 
if all goes well, told that the copy is 
complete. If you don't wish to copy a 
file press any other key. The next file in 
line is then presented for your decision. 
Be sure to reinstall your source disk 
before pressing "Y". 

In addition to the COPY command, 
the simple program makes use of 
another powerful disk command. 



DSKI$ is used in a loop to read the sec- 
tors in the directory track. It is the only 
BASIC command that can directly read 
the directory. The routine that reads 
and stores the filenames is modified 
from the routine provided on page 62 of 
the COCO disk manual. By the way, 
there is a slight error in the routine that 
will cause it to miss several files. Line 
60 reads FOR N = 1 TO 7; it should read 
FORN = 0TO7. 

The selective backup program 
routine uses several small arrays to 
read and identify the files that exist on 
a particular disk. Upon execution of 
line 160, the array FI$ contains the 
filenames of the program on the disk. 
Lines 170 to 230 present the filenames 
and invoke the copy command if 
necessary. This routine has saved me a 
lot of time and hassle. 

A Color Computer user's group has 
been formed in the Toronto, Ontario, 
Canada area. If you are interested in 
joining, you may contact Patricia 
Jackson at (416) 425-1116. Call week 
days after 6:00 p.m., or on the 
weekend. There is also a user's group 
in the Fargo, North Dakota area. Con- 
tact me and I will put your name on the 
meeting notice mailing list. Anyone 



wishing to pass along similar informa- 
tion can contact me directly at the ad- 
dress shown below. It will take two to 
three months for your notice to appeal 
in MICRO. 

Flumors are that Tandy has signed 
an agreement with a group of RCA 
distributors to market the Color Com- 
puter in retail outlets not handling 
Radio Shack products. The new Coloi 
Computer will have a different coloi 
case and new name. If you have more 
details On this, or any other news re- 
garding CoCo, pass it along. 

Recently, I received an interestinj 
musical program cassette. The classica 
rendition with four-voice organ music 
is the highest quality music routine '. 
have heard, and I was impressed wit! 
the thought that most programmers ar< 
not using CoCo's sound abilities tc 
their fullest. Several musical selection; 
are available from Classical Software 
893 1 Comanche Road, Longmont, Col 
orado 80501. They plan to announce i 
music editor with four-part tonal struc 
ture that will allow the user to enter anc 
play notes directly from sheet music. 

I own one of the early model Coloi 
Computers [serial number 337) anc 
follow news about theUadio Shack 32K 



Listing 1: COPY 



10 CLS : PR I NT34, "SELECTIVE BACKUP PROGRAM" 

20 PRINT340,"BY JOHN STEINER" 

30 PCLEAR 1 

40 CLEAR 2000 : DIM FI»(67) 

50 FOR X = 3 TO 11 

60 DSKI» 0,17,X,A«,B« 

70 C«=A« + LEFT* (B», 127) 

BO N»<0)=-LEFT»<C«,a) 

90 EX«(0)=MID«<C»,9,3) 

100 FOR N=0 TO 7 

110 N«(N)=MID«(C«,N«32-H,a) 

120 EX«(N)=MID«(C«,9-fN«32,3> 

130 IF LEFT»(N«(N) , 1)<:;>CHR»(0) 

THEN FI«(K)=N«(N)-f" /"+EX%I.N) 

140 NEXT N 

150 NEXT X 

160 CLS:PRINT364, "ENTER Y TO COPY" 

170 FOR J=0 TO K 

ISO PRINT3224,FI»(J) 

190 Z«=INKEY« : IF Z«="" THEN 190 

200 IF Z«="Y" THEN COPY FI«<J) 

210 IF Z«="Y" THEN CLS : PRINT3224, FI*(J) 

: NEXT I 
220 IF Z«="Y" 
230 NEXT J, 



AND LEFT»(Nt<N) 
I K=K-H 



DOCHR* (255) 



FOR 1=1 TO 400 



THEN PRINTSO, "PLEASE REINSERT SOURCE DISK' 



30 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



CoCO Bits (continued) 

modifications. I have wanted to 
upgrade to the new version for a while, 
but have not wanted to be without 
CoCo for the time it would take to 
make the change. I did increase 
memory capacity by piggy-backing ex- 
isting memory with 16K chips. It is a 
relatively inexpensive procedure and 
works well, giving fewer OM errors. 
One of the major disadvantages of this 
modification is that Radio Shack is 
replacing the early boards with an up- 
dated processor board and 64K RAM 
chips. The 64K chips are permanently 
wired making the upper 32K bank inac- 
cessible. A few simple changes allow 
you to restore the upper bank and 
deselect the ROMs that normally reside 
there. The user can then load another 
DOS, modify BASIC, or change the en- 
tire character of CoCo. When Radio 
Shack changed the memory chips, the 
company had to issue a new Color 
BASIC ROM. Color BASIC 1.1, in addi- 
tion to checking for and using 32K, has 
a few of the previous bugs removed. 
The 1 . 1 ROM will send 8-bit serial data 



to the printer port. This allows CoCo 
to send graphics or special characters to 
the printer without loading Tandy's 
PTFX program. 

I am interested in hearing from 
anyone who has modified a Color Com- 
puter to 64K without converting to 
the E board. I would also like to hear 
from FLEX and OS-9 users who suc- 
cessfully run their programs on CoCo. 
The added power and software com- 
patability is a major step for Color 
Computer programmers. 

Next month, in addition to CoCo 
news, I will discuss some books avail- 
able for Color Computer users. I will 
also take a look at medium- and high- 
resolution graphics modes available in 
Extended BASIC. 



You may contact the author at 508 Fourth 
Avenue NW, Riverside, ND 58078. 

iMCftO 



TIRED OF TYPING? 
MICRO has the solution. 

Order a diskette of three recent 
utility programs for the Apple. For 
only $10.00, plus $2.00 shipping 
and handling, you will receive a 
DOS 3.3 diskette containing the 
assembled listings of: 
Applesoft Vaiiable Dump by 
Philippe Francois (MICRO, April 
1982) 

Stiaightforwaid Garbage Collec- 
tion foi the Apple by Cornells 
Bongers (MICRO, August 1982) 
COMPRESS by Barton Bauers 
(MICRO, October, 1982) 
Please send check, money order, or 
VISA or MasterCard number. Only 
prepaid orders accepted. If you 
missed the above issues of MICRO 
they can be ordered now! Include 
$2.50 for each issue. 
Send orders to: 

Apple Utility Disk 
MICRO, P.O. Box 6502, 
Chelmsford, MA 01824 



FRANKLIN 

ACE 



•;•;• 



Apple II compatible 
64K of RAM 
Upper and lower case 
Typewriter-style keyboard 
12-key numeric pad 
Alpha lock key 
VIsiCalc keys 
50-watt power supply 
Built-in fan 



$1199.00 



MX-80FT 

w/Graphics 

$544.00 



AIM-65,4KRAM $465.00 



COMPLETE CATALOG -FREE 

COMPUTERS PRINTERS MONITORS 

MICROPROCESSOR COMPONENTS 



BedFord Micro Systems 

P.O. Box 1182, Bedford, Texas 76021 
(817) 283-0013 




A powerful 
utility that 
opensawindow 
into the Color 
Computer's disks. 



COLORZAP uses the poster of the 

Color Computer to provide both 

rapid scanning and full screen modifi- 

' cation capabilities. You can nowexamine, 

rrodify, and copy programs or data while 

they're stored on disk. Access them by filename 

■ location. 

COIORZAP is programmied largely in BASIC so that 
you can modify it if you'd like, but part of it is in machine 
language to provide fast response. All accesses to disk are 
performed with standard interfaces, so any standard Color 
Computer disk can be examined. You can directly access 
ttie disk's directory and control information to examine a 
clobbered disk, recover a killed file, or find parts of a file 
when other parts hove been lost. With this new window into 
its disks, the Color Computer sheds its image as a toy Now 
you can use this exciting machine like other powerful 
microcomputers. 

For the TRS-80 Color Computer Available on disk with an 
accompanying manual from Software Options, 19 Rector 
Street. New York, N.Y. 10006. 212-785-8285. Tbll-lree order 
line: aOO-22M«24. Price: $49.95 (plus S3.00 per jo^twaRE 

order shipping and trandling). New York 

State residents odd sales tax. Visa/Master- 
card accepted. 



SOFT WARE 
OPTIONS INC . 



No. 55 - December 1982 



MICRO - Ttie 6502/6809 Journal 



31 



AMCRO 

From Here to Atari 



By Paul S. Swanson 



Atari News 

I was pleased to see that Atari, Inc., 
recently established two regional soft- 
ware acquisition centers located in 
Cambridge, Massachusetts and London, 
England. The centers were set up to ac- 
quire software by contracting out for 
specific programs, or by buying software 
that has already been developed in- 
dependently, more centers are planned 
for the future; I'll let you know where 
they will be as soon as Atari annouces 
that information. 

Technical Tidbits 

Code conversion is required in two 
areas when you're programming the 
Atari. The "normal" character code, 
called ATASCII, is a variation of ASCn. 
There are two other character codes 
used by the system. One is used to 
write characters to the screen. The 
screen handler does this conversion 
automatically when you PRINT to the 
screen, but if you use your own 
routines and put the characters directly 
on the screen with POKE or a similar 
method, you need to convert to this 
screen code. 

The operating system manual in- 
cludes a table that shows you the cor- 
respondence between ATASCII and the 
screen code (which they call the "Inter- 
nal Code"). You can form a look-up 
table if you want by using a 256-byte 
string. Set it up so the value to POKE is 
the ASC( value of the byte in the string 
found at AVAL + 1, where AVAL is the 
ASC( value of the ATASCII character to 
be displayed. 

An alternative approach, which 
consumes less memory than the look- 
up table, is using dependent IF 
statements. Using N as the ATASCII 
value to display: 

FLAG = INT(N/128):N = N - FLAG -1-64: 
If N > 95 THEN N = N - 96: IF N > 64 
THEN N = N-(-32 

After you execute that one line of 
code (it must be in one program line). 



POKE the screen location with 
N + FLAG. FLAG will equal 128 for in- 
verse video characters and will equal 
zero for normal video characters in 
mode 0. There are two bits in modes 1 
and 2 that determine the color, but the 
conversion routine in the above IF 
statements will interpret them both 
correctly. 

The other code conversion would be 
for characters read from the keyboard. 
Several people have asked me how to 
eliminate the keyboard click. The only 
way to completely eliminate it would 
be to disconnect the keyboard speaker, 
but you can use another method if you 
write your programs to accommodate 
it. Instead of using INPUT and GET to 
obtain information from the keyboard, 
you can PEEK location 764. This loca- 
tion contains the keyboard code of the 
last key pressed on the keyboard. You 
must read this location, then POKE 
764,255. If the location contains 255 
you know that no key has been pressed 
since the last time you read it. 

The problem with this method is 
that the code you read is neither 
ATASCn nor the internal code. You 
can get the values of all of these codes 
by running the following program: 

10 REM ** KEYBOARD CODES ** 

11 REM ** STOP BY PRESSING BREAK** 

12 REM ** 

13 REM ** 

20 PRINT "PRESS KEY AND THIS PROGRAM 

30 PRINT "WILL DISPLAY THE 

40 PRINT "CORRESPONDING KEYBOARD 

CODE AS A DECIMAL VALUE:" 
50 N = PEEK(764) 
60 IF N = 255 THEN 50 
70 POKE 764,255 
80 ?N;" "; 
90 GOTO 50 



If you use this program as a sub- 
routine by itself, it will act as a GET 
statement. Putting the subroutine in a 
loop that stacks the codes in a string 
until it gets a RETURN code will act as 
an INPUT statement for alphanumeric 



input. For this, remember to display 
the characters on the screen and to 
make allowances for backspaces. Now 
your program will not produce a click 
with each keystroke. 

The only other common code con- 
versions required are for the graphics 
screens. Those are simpler than the 
other conversions. If you are using the 
standard screen set up by BASIC, it is 
much easier to use standard BASIC 
statements like PLOT and DRAWTO. 
If you want to set up a specific shape 
that would require a lot of DRAWTO 
commands for a relatively small area, 
you may want to use PRINT. 

Although converting to exact byte 
values to POKE onto the screen is 
possible, PRINT allows you to address 
each individual pixel on the screen. 
You PRINT an alphanumeric string to 
the screen through channel six. In 
mode 3, POSITION the graphics cursor 
at the beginning of one of the lines in 
the image, then PRINT #6; "112233" 
for two pixels each of colors 1, 2, and 3. 
To print the background color, which 
will allow you to erase an image, use 
zero, four, or a space. In two-color 
modes, use only zero and one. This 
method will save you substantial con- 
version over PEEKing and POKEing and 
will, in some cases, run much faster 
than the equivalent PLOT and 
DRAWTO statements. You don't need 
a COLOR statement for the PRINT 
method because you specify the color 
register directly, and there is an addi- 
tional advantage to providing a version 
of the image right in the program (in- 
valuable in debugging) . 

Next Month 

My January column will introduce 
the Operating System and Hardware 
manuals and a few other sources of more 
technical information on the Atari. I 
plan to make the Technical Tidbits a reg- 
ular feature, so send in your questions. 



XMCftO 



32 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



mnnsTER mflSH 





The Software Farm 
3901 So. Elkhart 
Aurora, CO. 80014 
PH: (303) 690-7559 



It is late at night in a monster infested graveyard and you have been 
given the job of keeping the monsters in. All you have between you and 
complete chaos is a new MonsterMasher System and quick reflexes. 

Monster Mash is an original and unique arcade action game written in 
assembly language for the Apple II and Apple / / / (in emulation mode). 



$29.95 



No. 55 - December 1 982 



MICRO - The 6502/6809 Journal 



33 



:\^i 



M 



'^\. 






When all hell 
breaks loose. 

Pandora's box is open. And all the evil; 
of the past are loosed upon mankinc 
Armed with bolts of lightning, you 
have the chance to recapture anc 
return these corrupt creatures 
of doom to the prison of 
Pandora's box. Time is short. 
The world is already changing 
for the worst. Your skills arrd 
courage iire needed. 















•«V-^ ■*■ 



* -^i*;? 



'-t-»i'~-; 



VT^pXjOT^xmk 



hatsworth, Ca 913fL 



y_5, '^.l^ytSfl/MASTERCARD accepted $^*Oshlpping7i 
'' ''-■'itr"''""' — fn 17-iiiJrnli iiilitft i^ni tUT tax 1 

f'JjjVIppfellisavademaifcofAppleCompiu^.Inc ■■.. 



■*•?*•. 






/MCRO 



News 



by Phil Daley, MICRO Staff Editor 

Apple Bits and Pieces 

As the release date for a new APPLE approaches, rumors 
fly fast and furious. Apple is securing sources for one 
million 68000 microprocessors, leading me to believe that 
the "Lisa" model (APPLE IV?] will be the first out, 
probably this Spring. It is to sell for approximately $8000 
and to be pitched at the business person who knows little 
about computers. At least, those are the rumors. 



Computer Stations, Inc., of Granite City, IL, and a D.C. 
Hayes Associates, Inc., microcoupler. Our telephone 
number is (617) 256-1446. 

After dialing into the Net-Works program, a self- ex- 
planatory menu is presented. The option (C)hat will not be 
supported. The first time that you log on you will be ex- 
pected to leave your name, etc., for subscription verification. 

This check will take at least one day. You will have 
only limited access to the system until your name has 
been verified and added to the queue of valid users. Please 
write down the password that the system assigns to you so 
that you can use it for future calls. A " < Ctrl > S" will tem- 
porarily stop the system in case it is scrolling too fast to 
read. Generally, new users may read the system, but not 
write to the system until verified. We are planning a com- 
munications issue for April with articles on all aspects of 
computer communications. If you have written an article 
or have any suggestions or criticisms, please send them to 
us here at MICRO. 



The "Seem alike" Franklin ACE 1000 may prompt Apple 
to release the Super Apple II sooner than originally an- 
ticipated. In addition to having 64K standard, rumor has it 
that the Super Apple II will contain far fewer chips on the 
mother board and will sell for substantially less. 

The Franklin looks like an Apple U, especially when 
you take the cover off (the only noticeable difference is the 
larger power supply). The mother board looks almost 
identical, although somewhat enlarged. The chips are all 
the same and the I/O slots are similar. The Franklin is 
delivered with Applesoft and the Apple monitor ROMs in- 
stalled. The other principal differences are that the Franklin 
accepts and displays lower case and has no color capabili- 
ties, soon to be remedied according to the manufacturer. 

Having lost the preliminary injunction ruling against 
Franklin, Apple is asking for a reconsideration due to a 
similar case that ruled in favor of the manufacturer. 
Apple's position is that object code is copyrightable, and 
therefore proprietary and not usable by others. 

Just to make the issue more complicated, Franklin is 
suing Apple for price manipulation and threatening Apple 
dealers who want to carry Franklin products. 

Also pushing on the retail price are the Far East imita- 
tions, yet to be seen in the U.S., which are selling at one- 
fifth the normal European selling price. 



There are rumors that the Mackintosh (also from Apple), a 
cheaper, simpler version of Lisa, is still in the develop- 
mental stage and is not expected until the end of next year 
at the earliest. 



MICRO Bulletin Board 

MICRO has instituted a sophisticated Bulletin Board/ 
Information Service System on our Apple II, which will be 
available to subscribers Monday through Thursday nights 
from 5;00 PM to 8;00 AM Eastern Time. The MICRO 
Bulletin Board System is using software developed by 



A Computer Center 

A new resource center has been opened in Newton, MA, to 
meet the educational and instructional needs of executives 
who are interested in learning how to make effective use of 
desktop computers. Called The Computer Forum, this 
educational institution will offer integrated courses, soft- 
ware selection, continuing help, and customized seminars 
to interested individuals and businesses. Course offerings 
will include How to Make Computers Work foi You, 
Using Youi Apple, Piogiamming in BASIC, Data Bases, 
Using Business Graphics, The Electionic Spreadsheet, Ad- 
vanced VisiCalc Techniques, and Management and 
Analysis Using VisiCalc. The Forum has several class- 
rooms, one for each system. Currently, only the Apple 
room is fully equipped, but plans call for an IBM PC room 
and possibly a XEROX room. Sign-up for the first schedule 
of courses has been brisk. We wish the Forum much suc- 
cess and hope that additional centers can be opened around 
the country. i»VICftO^ 



Statement of ownership, management, etc., required by the act of 
Congress of October 23, 1962, of MICRO, published monthly at 
Chelmsford, Massachusetts, for November 1982. 

The name and address of the publisher is MICRO INK, 34 
Chelmsford Street, Chelmsford, Massachusetts. The President/ 
Editor-in-Chief is Robert M. Tripp of Chelm^sford, Massachusetts. 

The owner is THE COMPUTERIST, Chelmsford, Massachusetts 
and the names and addresses of stockholders owning or holding 
one percent or more of the total amount of stock are: Robert M. 
Tripp and Donna M. Tripp of Chelmsford, Massachusetts. 

The known bondholders, mortgagees and other security holders 
owning one percent or more of the total amount of bonds, mort- 
gages or other securities are: none. 

The average number of copies of each issue of this publication 
sold or distributed through the mails or otherwise to paid 
subscribers during the twelve months preceding the date shown 
above is: 23,292. 

I certify that the statements made by me above are correct 
and complete. 

Signed: Robert M. Tripp 
President /Editor-in-Chief 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



35 



PIE WRITER. 



PEELINGS n Magazine did just that 
against 9 others. And PIE WRITER 
came out on top, rated AA+ . 

Why? Because PIE WRITER does every- 
thing a writer needs done, quickly, easily and 
inexpensively. If you can type, even with just 
two fingers, you'll be working comfortably 
with PIE within fifteen minutes. 

Begin immediately typing text onto the 
screen. You can add or delete characters, 
words . . . sentences . . . paragraphs with 
one simple key stroke. 

Misspellings? PIE WRITER'S. "search and 
replace" command corrects the word where 
you spot it . . . and then makes it correct 
throughout the entire text— be it a paragraph 
or a million dollar presentation. 

When your document is finished, a touch of 
the key will print out 1 or 99 copies ... in the 
format you want . . . neat, precise and always 
accurate. 

You can start using PIE WRITER on your 
basic Apple II system the moment you 
get it home. Nothing extra to buy. But you'll 
never outgrow PIE because it works with just 
about anything you might want to add: 

• 80-column boards • shift-key modification 

• lower case adapter • spelling checker 

• hard disks • VisiCalc* files 

• modems • program source files 



Just how functional: is PIE WRITER? 
Try these with any other word processor: 

5 ■ Character, word, Hne and paragraph 

editing 
; '* Global word search and replace 
: * Automatic centering 

Justify right and left plus incremental 

spacing 
*^ "Help" screen for quick reference 
F' Cut and paste 
•=' Automatic wrap ciround 
i'"" Forward and backward page scrolling 
^ • Custom form letters and mailing lists 
, ' ' Full format control 
V ' Status display 

Full control over ]Dage numbering, bottom 

and top headers 
J "* Save a segment of text on another file 
-' Insert text from another file 
!>' Underlining 
>' Control page breaks 
• Tabbing by word or moveable tab marks 
k^' Built-in training lessons 
; * And Pie Writer's comprehensive, indexed 

manual and quick reference card make it 

easy to use; it is very writer-friendly 



The best word processor available: 

PIE WRITER. For 

you just can't afford to buy anytiiing else. 

All you need to start is an Apple II with 
48K, 3.3 DOS, one disk drive, a monitor 
and printer. 



'VisiCalc is a registered trademark of VISICorp 



Available at your local computer store, or call 

1-800-343-1218 

(in MA, call 617/937-0200) 



1 1 AY DEN 



SOFTWARE 



It's All Relative— 
CBM Disk Techniques, Part I 



by Jim Strasma 



Contributing editor Jim Strasma 
begins a series that explains 
how to get the most from CBiVI's 
powerfui disl( operating system. 
Examples are drawn from a weil- 
written mailing list package that 
is both inexpensive and widely 
available. In Part 1 Jim covers 
global variables, combining 
BASIC with machine language, 
and chaining of program 
modules. 



Editor's Note: To implement all of 
these techniques you should have a 
DOS 2.0 (or later) disk drive. BASIC 4.0 
is also assumed. However, ways to 
emulate BASIC 4.0 disk commands 
from Upgrade BASIC and VIC BASIC 
are summarized. 

One of the best features of Com- 
modore's BASIC 4.0 and DOS 2 is its 
use of relative records for data files. 
This is a very powerful technique, not 
well matched by competing computers 
in Commodore's price range. However, 
relative records can be quite confusing, 
and though they have been around for 
two years now, are largely used in com- 
mercial programs. However, there is 
one large program package freely 
available that uses relative records — 
Chris Bennett's "Mail List 4040." In 
one form or another it has been around 
for about two years. For much of that 
time I have been modifying and 
documenting it. 

With the help of the mail list, this 
series of six articles will thoroughly 
explain the use of relative records. It 
will also cover some programming 
techniques for large packages and a 
machine-language program that takes 
much of the drudgery out of data entry 
programming. 

In this first article I will prepare the 
computer to run the mail list. In the 



process, I will: 1. show how to mix 
BASIC and machine language, 2. have 
one program load another without stop- 
ping or losing variables (called chain- 
ing], and 3. explain the use of global 
variables (called soft coding]. 

Because of the general availability 
of Bennett's "Mail List," a full listing 
will not be presented here. However, 
you don't need the program to under- 
stand the articles. If you do wish to 
obtain the program, see the box on 
page 41. 

Mixing BASIC and 
Machine Language 

One of the more difficult tasks in 
programming is mixing BASIC and 
machine-language code gracefully. 
When first released, the mail list used 
one common method, reading the 
machine-language portion from data 
statements and POKEing it into work- 
ing locations. This method easily 
allows changes to the BASIC program. 
However, if the machine-language por- 
tion is sizeable it can be slow; incor- 
porating substantial changes from a 
new assembly of the machine-language 
portion would be tedious at best. 

Next, I tried attaching the machine- 
language portion to the end of the 
BASIC code and using a machine- 
language SYS call to boot it into work- 
ing location. This method is fast. How- 
ever, it makes modifications to the 
BASIC program difficult, as any change 
in the length of the program also moves 
the machine code, guaranteeing a crash 
when the new version is used. 

Now I use a small trick to load the 
machine-language portion separately 
from the BASIC part. This method is 
quick and allows easy changes to both 
the BASIC and machine-language por- 
tions of the program. 

Line 1040 checks to see whether a 
key location contains the value it does 
when the machine code has been 



loaded. If not, MEMSIZ, the zero-page 
location that controls top-of-memory 
pointers, is lowered along with 
FRETOP, the top-of-dynamic strings 
pointer. (On the VIC, MEMSIZ is at 
$37 and FRETOP is at $33.) 

The two POKES protect the 
machine code from BASIC'S dynamic 
string variables. Note that if only 
MEMSIZ were altered, BASIC would 
think it had a negative amount of 
memory free. Since changing these 
pointers ruins any variables already in 
the top of memory, it is essential to do 
it only at the beginning of the first pro- 
gram module. 

1030 REM LOAD OBJECT PORTION 
IF HAVEN'T 

1040 IF PEEK(31232) < > 76 THEN 
POKE 53,122:POKE 49,122 
:DLOAD "OBJECT CODE" 

After resetting the memory 
pointers, line 1040 loads the machine- 
language portion from disk as a pro- 
gram named "object code." Usually 
loading a new program destroys the old 
one, but not this time. "Object code" 
loads very high in memory, beginning 
at location 31232, ($7A00). It will over- 
write anything else up there, such as 
Universal DOS support, but not BASIC 
programs located lower in memory. 

Since the DLOAD command was 
part of a nmning program, BASIC at- 
tempts to execute "object code" as 
soon as it is fully loaded. However, 
BASIC assumes its programs begin 
where another pointer, TXTTAB 
points. In this case, we've left it alone. 
This means that BASIC will execute 
"mail list 4040" again. That is the 
main reason for checking to see 
whether "object code" has already 
been loaded. Otherwise we would 
never get past line 1040. 

After the load the IF test in line 
1040 fails and the program continues. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



37 



commodore 



Chaining 

Line 1060 is another line that must 
appear at the beginning of the first pro- 
gram module. For program chaining to 
work correctly, we must either make 
the first program the largest one, or else 
convince BASIC that this is so. We 
could do this by adding dozens of long 
lines to the program as ballast. How- 
ever, this would add to its loading 
time, and take up more storage space 
on the disk. I have only followed that 
idea to the extent of coding this module 
very loosely, with mostly single-state- 
ment lines and lots of REMark state- 
ments. The added clarity is worth the 
slight waste. I also started with line 
number 1000 to keep all line numbers 
the same length, again for clarity. 

In early versions of the mail list, 
chaining worked by altering the file 
size pointer, VARTAB at location 42 
[$2A), as each module began. This 
worked because BASIC keeps track of 
the actual file size in pointer EAL, at 
location 201 ($C9), during a load. [On 
VIC, VARTAB is at $2D and EAL is at 
$AE.| We simply had a line like the one 
below at the start of each module. 

10 POKE42,PEEK(201):POKE43, 
PEEK(202):CLR 

Unfortunately, it won't work without 
the CLR, and once CLR is used, the old 
variables are gone. This means that a 
separate disk file has to be established 
and loaded by each module to remem- 
ber global variables, or the variables 
have to be hidden from BASIC and 
PEEKed. Either method is slow. 

By POKEing VARTAB with a value 
at least as large as it would need to run 
the largest module, we can use line 
1060 instead of line 10, and need it only 
in the first module. 

1060 POKE 42,0:POKE 43,53:CLR 

To determine the correct values to 
use here, load the longest module in 
your program, and enter: 

?PEEK(43) 

Add two to the result and write it 
down. Use that number in place of 53 
in line 1060. Note that we could have 
also PEEKed at 42, but I prefer to 
overstate slightly the required 
memory. This allows minor additions 
to that longest module without also re- 
quiring a change here. 



Don't make program changes to any 
module after loading it via a chain. 
BASIC no longer knows the module's 
true size. Instead, reload the module 
from disk in immediate mode and then 
make the changes. This is especially 
important if you have used line 10 
above. EAL isn't changed by line 
editing. If EAL points lower than the 
end of a modified BASIC program, line 
10 would force the variables to begin 
being stored on top of the last lines, 
ruining them. To prevent such dis- 
asters, it's always a good idea to save a 
modified program to disk before trying 
to run it. 

The actual chaining happens in line 
2060: 

2060 DLOAD D(PD), "4040 MENU" 
ON U(UN) 

For BASIC 2.0 and the VIC use: 

2060 LOAD STR$(PD)-l-":4040 
MENU", UN 

Soft Coding 

Notice the variables used in line 
2060 above: PD and UN (program drive 
and disk unit number]. They are set 
earlier in the program, in lines 1220 
and 1230: 

1220 UN = 8:REM DISK UNIT 
1230 PD = 0:REM PROGRAM DRIVE 

By setting them there and using 
only the variable names everywhere 
else in the program package, it is easy 
to change the package to work with dif- 
ferent equipment, such as a disk drive 
that answers to device 9 instead of 8. 
We will have more to say about soft 
coding shortly, but first we need to 
finish setting up. 

Setting Text Mode 

One other task awaits us in prepar- 
ing the machine. Commodore com- 
puters have two character sets, one for 
graphics and one for upper- and lower- 
case text. Since this program uses text, 
we must enable the text character set. 
A method that works for all CBM and 
PET models is given in lines 1080 and 
1090 below. (On the VIC, leave out line 
1080.] 

1070 REM SET TEXT MODE 

1080 POKE 59468,14 

1090 IF PEEK(57345)< > 54 THEN 

PRINT CHR$(14):REM UNLESS 

FAT 40 



For reasons that make sense only to 
Commodore, Fat 40's, (the 4016 and 
4032 with 12" monitor), are adjusted 
on the assembly line so that printing 
CHR$(14] zooms the top and bottom 
lines off the screen. The IF test in line 
1090 prevents this. However, there is 
also a hardware fix. On the underside of 
the video display board is a hole labeled 
"height." Your dealer can adjust your 
display in about 30 seconds to restore 
the lost top and bottom lines per- 
manently. If you do it yourself, remem- 
ber that metal screwdrivers are good 
conductors and the video board carries 
10,000 volts. One slip could do more 
than violate your warranty. 

The CHR$(14) is especially needed 
by 80-column models. If you leave it 
out and the machine was previously in 
graphic mode, lines will appear squished 
together. 

The matching lines to enable the 
graphic character set are: 

1070 REM SET GRAPHIC MODE 
1080 POKE 59468,12 
1090 PRINT CHR$(1 42) 

Leaving out the CHR$(142) on 
80-column models leaves them with a 
Venetian blind effect, separating lines 
of graphic characters. No Fat 40 fix is 
needed this time. (Line 1080 should 
still be omitted on the VIC.) 

Always establish one character set 
or the other at the start of any program 
package. CBM models start up in text 
mode, but PET models start in graphic 
mode. 



Initialization 

At this point the machine is ready. 
The machine- language portion is in and 
protected. The file pointers have been 
set for successful chaining and the 
character set is correct. Now the pro- 
gram begins a long process of initial- 
izing variables. Because this takes 
about five seconds, it is wise to give the 
user something to look at meanwhile. 
The mail list starts with a copyright 
message and then a status line: 



1200 PRINT' 



INITIALIZING 



This assures the user that the program 
hasn't died. If the delay will be more 
than half a minute, also give the user 
an estimate as to how long the task 
should take and an occasional progress 
report. 



38 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



commodore 



More on Soft Coding 

In the lines following 200 in this 
first module, the global variables are 
defined. Because they are not cleared 
by later modules, the way the entire 
package works can be modified 
drastically by changing a single line in 
this module. Naturally, the other 
modules have to be carefully written to 
take advantage of this power. We will 
see how this is done later in this series 
of articles. 

The global variables used tend to 
fall into three categories: those that 
define messages, those that define 
special characters, and those that act as 
flags to control the program. The first 
category allows easy changes to such 
things as field names or default field 
contents. These messages may also in- 
clude cursor control characters to be 
sure they appear at the correct location 
on the screen. To ease this task, the 
mail list predefines a position string of 
cursor controls in line 1880: 

1880 PO$="[HOME,23DOWN, 
7RIGHT]" + " " 

The characters shown in square 



brackets represent literal cursor charac- 
ters. The codes stand for one home 
character, followed by 23 cursor 
downs, followed by seven cursor rights. 
In the actual mail list, the literal 
characters are used and the codes are in 
a REMark statement at the end of the 
line. Always try to explain lengthy 
strings made up of cursor controls, 
especially if anyone will ever need to 
list your program to a non-Commodore 
printer. 

Later lines select needed portions of 
the program with LEFTS, as in line 
1940: 

1940 M2$ = LEFT$(P0$,8) + "START 
POSITION :" 

However, we must be sure the 
messages are stored in high memory 
where they will chain correctly. To do 
this, we concatenate a null string to 
each literal string in the program, as 
shown at the end of line 1880. 

If we didn't add the null string, 
BASIC would save space by pointing 
variable PO$ at its original memory 
location in line 1880. After chaining, 
this location would likely contain 



something quite different, and the 
string would be ruined. Adding the null 
string forces it into high memory where 
it is safe. 

The second category of variables is 
illustrated by line 1830: 

1830 QT$==CHR$(34) 

This is the quote character. It is needed 
later to allow INPUT# statements to 
read past troublesome characters like 
commas. We could use CHR$(34] 
everywhere instead, but CHR$ is a 
slow command in BASIC. Predefining 
QT$ is at least ten times faster overall. 
Other characters the mail list pre- 
defines include RETURN, SHIFTED- 
RETURN, and SHIFTED SPACE. We 
will explai:[i how each is used later in 
this series of articles. 

The third class of global variables is 
the controllers. These include both 
numeric and string variables, used in IF 
tests and within expressions later in 
the program. For instance, line 1210 
flags whether or not you want to allow 
the user to get out of the program by 
pressing STOP: 

(continued) 




SIGNALMAN MARK I DIRECT CONNECT 
MODEM - $89.50 

Standard 300-baud, full duplex, 
answer/originate. Powered by 
long lasting 9-volt battery Inot 
Included). Cable and RS-232 
connector included. 

EPROMS - HIGH QUALITY, NOT JUNK 

Use with PET, APPLE, ATARI, SYM, AIM, etc. 450 ns. $6.50 
for 2716, $12.50 for 2532. We sell EPROM programmers 
for PET and ATARI 



5% INCH SOFT 
SECTORED DISKETFES 

Highest quality. We use them on 
our PETs, APPLES, ATARIs, and other 
computers. $22.50/10 or $44.50/20 



NEW! C. ITOH STARWRITER F 10 
DAISY WHEEL PRINTER 

Letter quality, flawiess copy at 40 char/sec. Bidirectional 
printing, 15-inch carriage, uses standard Diablo ribbons 
and print wheels. ^'^ ^ = ^fffr 

PARALLEL - $1495, RS-232 - $J«8|tRACTDRS - $210 




MAE SOFTWARE DEVELOPMENT SYSTEM 
FOR PET, APPLE, ATARI 

'The Compatible Assembler" 

• Professional system for development of Machine Lan- 
guage Programs. 31 Characters per label. 

• Macro Assembler/Text Editor for Disk-based systems. 

• Includes Word Processor for preparation of Manuals, etc. 

• Standard Mnemonics - Ex.: LDA (LABEL), Y 

• Conditional Assembly, Interactive Assembly. 

• Editor has string search/search and replace, auto lirre 
numbering, move, copy, delete, uc/lc capability. 

• Relocating Loader to relocate object modules. 

• Designed with Human Factors Considerations. 

$169.95 

FLASH!! EHS Management has decided la allow S50.00 credit 
to ASM/TED owners who want to upgrade to MAE. To get this 
credit, return ASM/TED manual with order lor MAE. 

ATARI AND PET 
EPROM PROGRAMMER 

Programs 2716 and 2532 
EPROMs. Includes hardware 
and software. PET = $75.00- 
ATARI (includes sophisticated 
machine language monitor) = 
$119.95 



.^nfn 




PET BASIC SCROLL PROGRAM 

Scroll thru basic program using Cursor up/down keys. 
Specify computer. $6.00 on cassette, $9.00 on disk. 

Flip 'N' File diskette storage case (50-6(J disks )- 
$21.95 



Memory Test for Apple on Disk 
= $6.95 



$9.95, on Tape 



System Saver for Apple - Fan, Surge Protection, 2 
extra outlets, Apple power cord = $75.00 

BMC Green Screen Video Monitor. 

12 inch CRT, sharp, crisp 40 or 80 column display. 
= $90.00 

DC Hayes Smart Modem = $235.00, Micro Modem 
II = $289.00, Chronograph = $225.00 

C. Itoh Prowriter Printer. Better than MX80. We use 
constantly with our Apple and PET. Can be used on 
IBM, Atari, TRS-80, etc. 120cps, friction and tractor 
feeds, hi resolution dot graphics, nice looking, high 
quality construction. Parallel - $499.00, with IEEE 
interface for commodore - $599.00, RS232 - $660.00 



3239 Linda Dr. 
Winston-Salem, N.C. 27106 
(919)924-2889 (919)748-8446 
Send for free catalog! 




MostorCord 



No. 55 - December 1982 



IvIICRO - The 6502/6809 Journal 



39 



commodore 



1210 NS = 0:REM NON-STOP? 

If NS = 1, the program becomes non- 
stop; a great idea when using untrained 
operators, but a terrible idea when a 
skilled user is trying to modify the 
package. 

An example of a string variable used 
as a control is PZ$, defined in line 
1310: 

1310 PZ$ = "A":REM ASCII, P= PET 

One of the skills of the machine- 
language portion of the package is that 
it can convert strings from PET ASCII 
to true ASCn codes and back again. 
This is useful when working with a 
modem or a non-Commodore printer. 
Line 1760 shows how this feature is 
used or skipped, depending on the con- 
tents of PZ$: 

1750 REM FLIP CASE OF ASCII 

PRINTER PROMPTS 
1760 IFPZ$< > "A" THEN 1830 
1770 SYSSM,1,NA$ 
1780 C3$ = C1$ 
1790 SYSSM,2,C3$ 



1800 C4$ = C2$ 
1810 SYSSM,2,C4$ 

My personal copy of the mail list 
carries the control variable idea a step 
further by using the variable TY to 
select between using the package as a 
church mail list, a computer users' 
mail list, and a sermon fUe, depending 
on whether TYpe = 1, 2, or 3 in a new 
line added to this module. 

The other special options set by the 
global variables are explained in the in- 
structions that come with the mail list 
package, so I won't take space for them 
here. However, if you do get the pro- 
gram, notice that all the simple vari- 
ables are defined before the arrays are 
defined. Doing things in this order cuts 
the initialization delay by 2.5 seconds. 
Further speed gains are possible by ar- 
ranging the lines so the most-used 
variables and arrays are defined before 
those used less often. The ones most 
heavily used are usually inside nested 
loops and often-used subroutines. 

Using Piogiam Intelligence 

The program selects either an ASCII 



or a PET printer, as we saw in line 
1310. However, it doesn't simply 
assume the printer is on, but goes to 
the trouble of checking, in lines 
1350-1380: 

1300 DV = 4:REM PRINTER 



1340 REM BE SURE PRINTER IS ON 
1350 OPEN 4,DV 

1360 PRINT#4,CHR$(7);;REM BELL 
1370 IF ST THEN PZ$ = "N": 

PRINT" PRINTER IS OFF 

1380 CLOSE 4 

Line 1360 tries to print a BELL 
character to the selected printer device. 
If it succeeds, the IF test of the status 
variable will fail in line 1370. Other- 
wise, a warning is printed and the 
printer control variable is set to show 
no printer is on line. This allows users 
without a printer to safely use the 
package. 

A similar technique is used in lines 

1250-1290: 

(continued) 



PET/CBM 

SOFTWARE 



I 



8032 OR 4032 

DISPLAY DISPLAY 

FROM THE KEYBOARD OR PROGRAM 
NOW RUN WORD PRO 3 OR WORD PRO 4 

FROM THE SAME MACHINE 

Available for either 4000 or 8000 Series 

ALSO: 
For 2001 / 3000 Series Computers 

Operate these Models in a Full 8032 Like 

Display For Word Pro 4* 

and all other 80 Column Software 

All installation instructions included. 

EXECOM CORP. 

1901 Polaris Ave. 
Racine, Wl 53404 
Ph.414-632-1004 

PET/CBM a trademark of Commodore Business Machines 
*trademarl< of Professional Software, Inc. 




Quit Playing Games . . . 

Disk Based Software to Make Your 
Computer Get Down to Business 

Disk Based Data Manager— Create and manage your own 
data base. Allows you to create, add, change, delete, 
search, sort, print, etc. Available for VIC-20, Commo- 
dore 64 , any CBM or Pet, and IBM Personal Computer. 
VIC-20 59.95 All others 79.95 

Inventory Control Manager— Fast, efficient inventory 
package which will manage your day to day inventory 
requirements. Provides; Information on sales and 
movement of items. 

Mailing List Managei^-4 ,050 items per SOSO disk, 1,300 
on 4040 disk and 1,200 on 1S40/1S41 disk. User defined 
label format (1—4 ) across. 

Payroll System— Full featured complete Payroll System. 
Up to 350 employees on a S050 disk. Prints checks, 941 's 
and W-2'$. For the CBM S032/S050, 4032/4040, Commo- 
dore S4 /I S41. 

Hospitality Payroll— The most complete payroll system 
written specifically for the Restaurant Industry available 
today. Recognizes tip and meal credits, pay advances, 
salaried and hourly employees, etc. For the CBM 
8032/8050. 

CONTACT US FOR ALL YOUR 

DISK BASED SOFTWARE NEEDS 

Call for specifics on Hardware Configurations. 

Send Self-Addressed Stamped Envelope for 

Catalogue of Games and other Applications 

DEALER INQUIRIES WELCOME 



^ 



2905 Ports O'Call Court 

Piano, Texas 75075 

(214) 867-1333 

VISA and MASTERCARD Accepted 



40 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



commodore 



1240 REM SELECTS DATA DRIVE 

1250 DD = 1 

1260 OPEN 15,UN,15 

1270 PRINT#15,"INITIAL1ZE" + 

STR$(DD) 
1280 IF DS = 74THEN DD = 0:REM IF 

SINGLE DRIVE 
1290 CLOSE 15 

As these lines initialize disk drive one, 
they identify single drive units and 
prepare the program to work with 
either single or dual drives. 

An earlier version of the program 
had the user select one or two drives 
manually by changing line 250. How- 
ever, I use both single and dual drives 
often, and decided it made more sense 
to let the computer use its own in- 
telligence to work with all Commodore 
disk drives. This kind of intelligence in 
a program means more work for the 
programmer once,'but less work for all 
the users for years to come. Programs 
you expect to give or sell to others 
should work on all existing and likely 
models. (If I followed that advice fully, 
this program would have used BASIC 
2.0 disk commands, at some cost in 



speed and a great cost in clarity.) 

Next time we will begin working 
with relative records — creating the 
files needed by the mail list package. 

ifVICftO 



How to Obtain 
Bennett's "Mail List" 

Many users' groups will have this 
program in their libraries. It is also 
available from ATUG (200 S. Cen- 
tury, Rantoul, IL 61866), TPUG (381 
Laurence Ave W., Toronto, Ontario 
M5M 1B9, Canada), or from the 
author as part of his HELP disk. The 
HELP disk is a companion to the 
third edition of Osborne/McGraw- 
Hill's CBM and PET Computer 
Guide (edited by the author). 

To obtain the HELP disk send 
$15 to the address below. Specify 
4040/2031 or 8050 format. 

HELP Disk 

Jim Strasma 

1280 Richland Ave. 

Lincoln, I L 62656 



WHAT'S WHERE IN THE APPLE 
A Complete Guide to the Apple Computer 

This REVISED EDITION of the 
famouo Apple Atlas provrdes Apple 
cornputerists with a framework for 
undersitanding both the ovprall 
organization and structure of the 
Appjp system and programming 
technik^ucs that exploit that 
knowledge 

What's Where In the Apple contains 
the most complete memory map 
pver published as well as detailed 
information needed for actual 
programming 

All for only $24.95 

(plus S5.00 s/hl 

For owneis of the original edition, 
MICRO IS offering a companion 
book, THE GUIDE to WhaVs Where 
In the Apple, for only S9.95 (plus 
523t»s/h1 

THE GUIDE contains all new 
material that explains and 
demonstrates how to use the atlas 
and gazetteer published in the 
original volume of What's Where in 
the Applet 




VISA and MasterCard accepted 



MICRO maizes it easy to order! 
Send checi( to: 

MICRO INK 

P.O. Box 6502 

Chelmsford, MA 01824 

Or call our toll-free number: . 

1-800-345-8112 

(In PA, 1-800-662-2444) 
MA residents add 5% safes tax 



STATISTICS 

PURE AND SIMPLE 




Human Systems Dynamics programs offer you 
flexibility^ accuracy, and ease of use. You can 
purchase from the HSD statistics specialists 
with complete confidence. Any program that 
doesn't suit your needs can be returned within 
10 days for full refund. 



NEW 



STATS PLUS 



$200.00 



Complete General Statistics Package 

Research Data Base Management 

Design and Restrvcture Your Files 

Count, Search, Sort, Review/Edit 

Add, Delete. Merge Files 

Compute Data Fields, Create Subfiles 

Interface with other HSD programs 

Produce Hi Res bargraphs, plots 

1—5 way Crt}sstabulation 

Descriptive Statistics for all Fields 

Chi-Square, Fisher Exact, Signed Ranks 

Mann-Whitney, Kruskal-Wallis, Rank Sum 

Friedman Anova by Ranks 

10 Data Transformations 

Frequency Distribution 

Correlation Matrix, 2 way Anova 

r. Rho, Tau, Partial Correlation 

3 Variable Regression, 3 t-Tests 



ANOVA II 



$150.00 



Complete Analysis of Variance Package 
Analysis of Covariance, Randomized Designs 
Repeated measures Designs. Split Plot Designs 
1 to 5 Factors. 2 to 12 Levels Per Factor 
Equal N or Unequal N. Anova Table 
Descriptive Statistics. Marginal Means 
Cell Sums of Squares. Data File Creation 
Data Review/Edit, Data Transformations 
File Cambirmtions, All Interactions Tested 
High Resolution Mean Plots. Bargraphs 



HSD REGRESS 



$99.95 



Complete Multiple Regression Analysis 
Up to 25 Variables. 300 Cases/Variable 
Correlation Matrices. Descriptive Statistics 
Predicted & Residual Scores. File Creation 
Regression on Any Subset of Variables 
Regression on Any Order of Variables 
Hi-Res Scatterplot & Residual Plot 
Keyboard or Disk Data Input 
Case X Case Variable x Variable fnpur 

Apple II, 48K 1 or 2 Disk Drives 
3.3. DOS, ROM Applesoft 

Call (213) 993-8536 to Order 

or Write: 
HUMAI^ SYSTEMS DYNAMICS 
9249 Reseda Blvd., Suite 107 
^^^Northridge, CA 91324_^ 
VISA 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



41 



commodore 



Squeeze for PET 
BASIC Program 



by Hans Hoogstraat 



This short routine removes the 
unnecessary spaces, REMs, and 
blank lines from a BASIC 
program. It is relocatable and 
does not require maintaining 
two versions of the BASIC 
program. 



SQUEEZE 

requires: 

PET/CBM — original, upgrade, 
or 4.0 ROMs 



This routine squeezes all the imbedded 
blanks, line separators, and comments 
from a BASIC program. In addition, the 
following syntax conections are made: 

1. GOTO = GOTO 

2. IF GOTO = IF .. THEN 

3. IF .. THEN GOTO = IF .. THEN 
SQUEEZE is relocatable and can be 

stored in either cassette buffer. It is 
designed to be called with a SYS com- 
mand in the first line of your BASIC 
program. This means that you need to 
store only one copy — fully com- 
mented and expanded — of your pro- 
gram on tape or disk. When you run the 
program, it is automatically com- 
pressed first. 



BASIC Example Piogiam: 
|XXX = ADDRESS OF 
ROUTINE] 



SQUEEZE 



10 


SYSXXX 




15 






20 


REM EXAMPLE PROGRAM 


25 






30 


PRINT" 


EXAMPLE PROGRAM" 


35 






40 


FOR 1 = 


1 TO 10 


45 


:::PRINT 


1, SQR(I)::REM ROOTS 


50 


NEXT 




55 






60 


IFI <> 


THEN TO TO 80 ;: 



65 : 

70 I = 1:::B = 1: 

75 : 

80 END 



REM NONSENSE 



After the SYSXXX squeeze call, the 
program continues execution with the 
following BASIC code: 

10 SYSXXX 

30 PRINT-EXAMPLE PROGRAM" 

40 FORI = 1TO10 

45 PRINTI,SQR(I) 

50 NEXT 

60 IFI < > 0THEN80 

70 1 = 1:8=1 

80 END 

Cautions: 

1. Do not use SYS XXX; any blanks 
between SYS and XXX can confuse 
the BASIC run-time pointers. 

2. Any GOTO, GOSUB, or THEN 
references to REM-commented lines 
or : null lines will become erroneous 
due to the deletion of these lines. 
(Ed. note: SQUEEZE does not handle 
these references.) 

SQUEEZE can be loaded into the 
first or second cassette buffer and can 
then be permanently saved with the 
BASIC program using the machine- 
language monitor SAVE command, or 
it can be made part of the program with 
DATA statements containing the 
machine- language code to be transfer- 
red to a suitable spot in memory using 
POKE commands. 

Here is the procedure to save a 
BASIC program with SQUEEZE in the 
cassette buffer. (Original ROM: use 
first cassette buffer — $027A - $0339; 
upgrade ROM: use either cassette buf- 
fer — $G27A - $0339 or $033A - $03F9; 
4.0 ROM: use second cassette buffer — 
$033A - $03F9.) 

1. Load SQUEEZE routine into correct 
buffer. 

2. Type NEW and load BASIC program. 



3. Type SYS4, which will display (4.0 
ROM) 

PC IRQ SR AC XR YR SP 
.; 0005 E455 30 00 5E 04 FO 

4. Type .M 002A 002B to display the 
start-of-BASIC variables pointer, 
which is usually the same as the 
end-of-BASIC text pointer. Assume 
the following display from the above 
command: 

.M 002A002B 

.; 002A 4B 04 4B 04 4B 04 00 80 

5. Now, to save the BASIC program and 
the SQUEEZE routine together on 
disk assuming SQUEEZE was loaded 
in the first cassette buffer, type 

.S "0:EXAMPLE",08,027A,044B 

027A = Start address of first cas- 
sette buffer. 

044B = Contents of end-of-BASIC 
text pointer as displayed in 
locations $002B-$002A. 

For tape use 01 instead of 08. 

General Infoimation 

All CBM system labels references 
are consistent with the labels specified 
in Appendix F of the PET/CBM Pei- 
sonal Computei Guide by A. Osborne. 

Hexadecimal dumps of the routine 
assembled for the three different ver- 
sions of the PET ROMs are included in 
this article. 

With some minor pointer modifica- 
tions, the SQUEEZE routine should alsc 
operate on most other 6502 systems. 



Hans Hoogstraat is a scientific research 
and systems development software and 
fiardware consultant to the petroleum in- 
dustry. You may contact him at Box 20, 
Site 7, SS 1, Calgary, Alberta, Canada 
T2M 4N3. 



42 



MICRO - The 6502/6809 Journal 



No. 55 - December 198; 



commodore 



Listing 1: SQUEEZE Assembled for 4.0 ROMs 



121330- 


flS 


01 


e33C- 


S5 


2fl 


ei33E- 


R0 


04 


0340- 


84 


2B 


0342- 


85 


54 


0344- 


84 


55 


0346- 


RS 


00 


0348- 


FI2 


00 



0010 
0020 
0030 

0040 

0050 
0060 

0070 

0080 



jSVSTEM EQUFITES 



iBRSIC 
.; BRS I C 
sBRSIC 

BRSIC 



.DI 
,DI 
-01 



jORIOINRL ROM 
JUPQRRDE ROM 
;BflSIC 4.0 





0100 
01 10 
0120 


. 






q 


iuee: 






' 








E 


















0130 
0140 
0150 


:THIS ROUTINE SQUFF7FS 
jIMBEOOED BLRNKS, LINE 

• 


R BRSIC PROGRRM FROM ALL ITS 
SEPRRRTORS RND COMMENTS. 




0160 

0170 
O180 


:IN ROC 

;1. GO 
yz. IF 
;3. IF 


IT ION THE FOLLOWING 
1"Q ~ rsriTr-i 


SVNTRX CORRECTIONS RRE MADE i 




0190 
0200 
0210 




.... 


GOTO = 
GOTO = 


IF . . 
IF .. 


THEN 
THEN 




■■ 


THEN 




0220 
0230 


: BRSIC 


REFERENCES. 








0240 






IFE 


BRSIC-1 








0250 
0260 
0270 


BPOINT 

WORK 

LHKPRG 




.01 
.01 
.DE 


»7R 
»R6 
*C430 








0280 
0290 


;-- 




*•• 










0300 

0310 


BPOINT 




IFE 
.01 


BRSIC- 3 
*2S 








0320 
0330 
0340 


WORK 
LNKPRO 




.DI 
.DE 

**• 


*54 
*C442 








0350 


; 














0360 






IFE 


BRSIC-4 








0370 


BPOINT 




.DI 


*23 








0380 


WORK 




.DI 


*54 








0390 


LNKPRO 




.DE 


«B4B6 








0400 
0410 


: 




•«* 










0420 
0430 


; 




.BR 


BPOINT 






ee£s- 

002R- 


0440 
0450 


TXTTRB 
VRRTRB 




.OS 
.OS 


2 




; POINTER TO STRRT OF BRSIC 
; POINTER TO STRRT OF VRR. 


002C- 


0460 


RRVTRB 




.OS 


2 




jPNTR TO STRRT OF RRRRV TR 


002E- 


0470 
0480 


STREND 




.DS 


2 




;POINTER TO END OF VRR. 




0490 
0500 


JPRGE 2 


ERC 


WORK RRERS. 








0510 

0520 


; 




.BR 


WORK 






0054- 
005S- 


0530 
0540 


INPPTR 
NXTLIN 




.DS 
.DS 


2 

2 




; INPUT LINE POINTER. 
sNEXT BASIC LINE RDDRESS 


0058- 
0059- 


0550 
0560 
0570 


OUTPTR 
IMP I NO 
OUT I NO 




.01 
.DS 
.DS 


VRRTRB 




.! OUTPUT LINE POINTER. 
.: INPUT TEXT INDEX. 
;OUTPUT TEXT INDEX. 


005R- 


0580 


OUTSEG 




.DS 






; OUTPUT LINE SEGMENT LEHGT 


005B- 


0590 


OTFLflO 




.OS 






sQUOT FOUND FLRO. 


0O5C- 
005D- 


0600 

0610 
0620 
0630 
0640 


PRVOUT 
I FFLRC. 
; 
RRMLOO 




.DS 
.DS 

.DI 


*400 




jPREVIGUS OUTPUT CHARACTER 
;IF TOKEN FOUND FLRG. 

jSTRRT BRSIC TEXT 




0650 


: BRSIC 


TOKEN EQURTIONS 








0660 
















0670 
0680 
0690 
0700 
0710 


OOTOTK 

IFTK 

REMTK 

TOTK 

THENTK 




.DI 
.DI 
.DI 
.DI 
.DI 


*S9 
*8B 
*8F 
*R4 
*R7 




sGO TO 

;IF 

;REM 

;T0 

,:THEN 




0720 


GOTK 




.DI 


*ce 




;G0 




0730 


; 













034R- Bl 54 
034C- sr 2R 
a34E- 99 56 30 



0750 
0760 
0770 
0730 
0790 
0800 
0810 
0820 
0830 
0840 
0850 
0860 
0870 
0880 
0390 
0900 
0910 
0920 
0930 
0940 
0950 
0960 
0970 
0980 
0990 



.BA »33A 

jSET BRSIC OUTPUT LINE RDDRESS POINTER. 

SQUEEZE LDR »L,RRML0C+1 
STR •OUTPTR 
LDV »H,RflMLOC+l 
STV »0UTPTR+1 

.:SET BRSIC INPUT LINE RDDRESS POINTER. 

NEXTLIN STA NlINPPTR 

STV •INPPTR+1 

;RESET ALL BRSIC SCAN LINE FLAGS. 

LDV #0 
LDX #0 

;COPV BRSIC LINK AND LINE NUMBER FROM INPUT TO OUTPUT. 



LDH <INPPTR>,V 
STR <0UTPTR;',V 
STR NXTLIN, V 



(Continued on next page) 



TURN AN EPSON PRINTER 

INTO A DAISY . . . 

with the 

SUPER-MX CARD 

for the APPLE II. 

The standard of printing excellence is the 

daisy-wheel printer. The SUPER-MX card 

provides the Epson printers with just 

about the same quality print as the 

daisy-wheels! 

SUPER-MX Roman font is 
the standard. 
Epsons can now print Elite 
with the SUPER-MX card. 

Other optional font styles are available 
in addition to the standard Roman font 
that just plug into the extra sockets pro- 
vided. They come In pairs so you can add 
a total of four extra fonts. Orator Large 
comes with Letter Gothic. Script comes 
with Olde English. 

LETTER GOTHIC is 
modern "I ook i ng . 
ORATOR is easy to read 
and 9ood for speeches. 
SCRIPT adcLc X.he. 

IQCHE CNSCSJSH is vpry 
fariaal and plpgant . 




Apple Hi-Res graphics is fully sup- 
ported with a wide variety of commands 
including: double dumps (both pages 
side by side), dump from page 1 or 2, 
double size, emphasized, rotated, strip 
chart recorder mode, and text screen 
dump. 

The two expansion sockets allow 
EPROM expansion to 12K to insure you 
that the SUPER-MX card will remain the 
most intelligent interface around. 

An Epson MX-80 needs Graftrax or 
Graftrax-Plus. An MX-100 requires Graf- 
trax-Plus. Warranty is 90 days. 

SUPER-MX card with cable .... $175.00 
Orator and Letter Gothic Fonts . . $30.00 
Script and Olde English $30.00 

Cash, cashiers check or money order. 
Personal checks will require 2 weeks to 
clear. California residents add 6y2% 
sales tax. 

Spies Laboratories 
{pronounced "speez") 

P.O. Box 336 

Lawndale, CA 90260 

(213) 644-0056 

Apple II Is a TM of Apple Computer, Inc. 
Graftrax is a TM 01' Epson America, Inc. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



43 



commodore 



Announcing 

THE GUIDE 

A Complete Guide 
to the Apple Computer 




If You Own the Original 

What's Where in the 

APPLE? 

You Will Want 

THE GUIDE 

A Complete Guide 
to the Apple Computer 

only $9.95* 

The Guide provides full explanatory 
text to lead you through the most 
complete Apple memory map ever 
published! 

The Guide explains and 
demonstrates how to use the atlas 
and gazeteer published in the 
original volume! 

If you missed the first edition of 
What's Where in the Apple?, a new 

revised edition containing BOTH the 
original atlas and gazeteer AND the 
all new Guide is available in one 
256-page, Wire-G-Bound book for 
only $24.95! 

MICRO makes it easy to order: 
Send check (payable to MICRO) to: 

MICRO INK 
P.O. Box 6502 
Chelmsford, MA 01824 

Call our toll-free number: 

1-800-345-8112 

(In PA, 1-800-662-2444) 
VISA and MasterCard accepted 

"Add $2.00 shipping per book. 
MA residents add 5%. 

83-370 



Listing 1 (continued) 



0351^ 


96 


58 


1000 




STX 


KiOUTSEe,V 




8353- 


CS 




1010 




INV 


- 




0354- 


C0 


04 


1020 




CPV 


*4 




0356- 


90 


F2 


1030 

1040 


; 


BCC 


COPVLNK 










1050 


; CRRRV 


SET 












1060 


; 














1070 


;SET STRRT 


B8SIC INPUT 8ND OUTPUT TEXT INDEXES. 








1080 


; 








0358- 


84 


58 


1090 




STV 


♦INPIND 




035fl- 


84 


59 


1100 

1110 


. 


STV 


♦OUTIND 










1120 


; CHECK FOR 


END 


OF B8SIC TEXT. 










1130 


; 








035C- 


80 


ai 


1140 




LDV 


*1 




035E- 


Bl 


28 


1150 




LD8 


<OUTPTR),V 




0360- 


00 


16 


1160 
1170 


; 


BNE 


SCRN 










1180 


;8DJUST ST8RT OF VRRIRBLE RDDRESS. 








1190 


f 








0362- 


H2 


05 


1200 
1210 


! 


LDX 


#5 




0364- 


R4 


2B 


1220 




LDV 


♦VRRTSB+l 




0366- 


R5 


2R 


1230 




LD8 


♦VORiaB 




0368- 


69 


01 


1240 




SDC 


*1 


;WITH CSRRV SET = 8DC #2. 


0361=1- 


90 


01 


1250 




BCC 


CLR 




036C- 


C8 




1260 
1270 


} 


INV 


- 










1280 


J PERFORM BRSIC 


CLR 










1290 


J 








036D- 


94 


28 


1300 


CLR 


STV 


♦OUTPTR.X 




036F- 


C8 




1310 




DEX 


- 




0370- 


95 


28 


1320 




ST8 


♦OUTPTR.X 




0372- 


CR 




1330 




OEX 


- 




0373- 


10 


F8 


1340 
1350 


; 


BPL 


CLR 










1360 


JFIX BRSIC 


LINKS 8ND RETURN TO 


C8LLER. 








1370 


; 








8375- 


4C 


B6 84 


1380 
1390 
1400 


LINK 
; 


JMP 


LNKPRG 




















1410 


; 














1420 


;SCRN BRSIC INPUT TEXT LINE. 










1430 


; 








0378- 


84 


38 


1440 


SC8N 


LDV 


♦INPIND 


;eET 8H INPUT TEXT CHRR8< 


0370- 


Bl 


54 


1450 




LD8 


<INPPTR>,V 




037C- 


E6 


53 


1460 
1470 


.! 


INC 


*INPIND 


sBOOST INPUT TEXT INDEX. 


e37E- 


86 


58 


1480 




LDX 


♦.I3TFL8C. 


;B8SIC ClUOT FOUND FL8G Ot 


0330- 


D0 


45 


1490 
1500 


; 


BNE 


OUTTEXT 


;VES .. COPV RLL TEXT CHI 


0332- 


C9 


20 


1510 




CMP 


#■■ 


;TEXT = BL8NK ? 


0334- 


F0 


F2 


1520 
1530 


; 


BEO 


SC8N 


.!VES .. IGNORE BL8NKS. 


0386- 


C9 


8F 


1540 




CMP 


WREMTK 


jTEXT = REM ^ 


0388- 


DB 


01 


1550 
1560 


; 


BNE 


CKSEO 


..-NO . . . NEXT CHECK. 


0338- 


38 




1570 
1580 


; 


TXR 


- 


;VES .. FORCE END-OF-LINI 


0338- 


C9 


38 


1590 


CKSEG 


CMP 


#' ! 


SEND OF TEXT LINE SEGMEK 


038D- 


D0 


08 


1600 
1610 


.! 


BNE 


CKEOL 


;N0 . . . NEXT CHECK. 








1S20 


! C8RR', 


SET 












1630 


; 








eseF- 


36 


50 


1640 
1 650 


; 


STX 


• I FFL8G 


jVES . . RESET IF FLRG. 


0391- 


fl4 


58 


1660 




LDV 


♦.OUTSEC 


;8NV SEGM. CH8RS . ON OUTI 


0393- 


F0 


E3 


1670 
1680 




BEQ 


SC8N 


;N0 ... IGNORE SEGM. SEPI 


0395- 


C8 




1690 




DEX 


- 


sVES . . TRIGGER ZERO SEGi 


0396- 


86 


58 


1708 
1710 


! 


STX 


*OUTSECi 










1720 


: C8RRV 


STILL SET . 










1730 


; 








0398- 


90 


88 


1740 
1750 


NEXTLINJ 

; 


BCC 


NEXTLIN 


;LONG JUMP RCCOMODflTION. 


0398- 


88 




1760 


CKEOL 


T8X 


- 


.:TEXT = END-GF-LINE ? 


039B- 


Fa 


28 


1778 
1730 


; 


BEO 


OUTTEXT 


..-VES . . COPV EOL-TEXT CH 


0390- 


E6 


58 


1790 
1800 




INC 


♦OUTSECi 


:INCR. OUTPUT SEGMENT CH 


a39F- 


84 


5C 


1310 
1320 


■ 


LOV 


♦.PRVOUT 


sOET PREVIOUS OUTPUT CH8 


03fll- 


C9 


SB 


1 330 


CKIF 


CMP 


#IFTK 


.jTEXT = IF TOKEN -> 


0383- 


00 


02 


1340 
1350 


; 


BNE 


CKCiO 


.jNO . . . NEXT CHECK. 


03fl5- 


85 


5D 


1360 
1370 




ST8 


♦IFFL80 


;FL8G H8PPENIHG. 


03fi7- 


CS 


CB 


1330 


CKCO 


CMP 


»OuTK 


jTEXT = GO TOKEN ? 


0389- 


oe 


82 


1890 
1900 




BNE 


CKTO 


!H0 ... NEXT CHECK. 


0388- 


89 


39 


1910 
1920 


; 


LOR 


WCOTOTK 


!VES . . REPLRCE BV GOTO 


0380- 


C3 


84 


1930 


CKTO 


CMP 


WTOTK 


:TEXT = TO TOKEN ? 


03RF- 


00 


08 


1940 
1950 


; 


BNE 


CKIFCO 


;N0 ... NEXT CHECK. 


0381- 


ce 


39 


1960 




CPV 


wcototh: 


.jpRECEEDED E;V GOTO TKEN -> 


0383- 


F9 


C3 


1970 
19S0 




BEQ 


SC8N 


;VES . . IGNORE INPUT TO 



44 



MICRO - The 6502/6809 Journal 



No. 55 - December 19 



commodore 



Listing 1 


(continued) 




























03B5- 


ce 


R7 


1 990 






CPV 


#THENTK 




sPRECEEDEO 


BV THEN TOKEN 


r' 


03B?- 


pa 


BF 


20O0 






BEQ 


SCRN 






:VE 


5 . . 


IGNORE INPUT 


TO 


TO 








20 1 




























03B9- 


R6 


5D 


2020 i; 


KIFi; 





LDX 


♦IFFLfle 




JlF 


TOKEN FOUND 


-. 






03BB- 


F0 


SR 


2030 






BEQ 


OUTTEXT 




;N0 




COPV TEXT CHRRRCEP 








2040 




























eSBD- 


C? 


89 


2050 CKCIOT 


It 


CMP 


#00TOTK 




;TE 


<T = 


GOTO TOKEN ? 






03BF- 


00 


06 


2060 
2070 






BNE 


OUTTEXT 




^NO 


... 


COPV te; 


a CHARRCTE 


03i;:l- 


CO 


H7 


2030 






CPV 


#THENTK 




;PRECEEOED 


BV THEN TOKEN 


■T' 


0303- 


F0 


B3 


2090 






BEQ 


SCRN 






;VE 


S . . 


IGNORE INPUT 


GOTO 1 








2100 . 




























153C5- 


H9 


R7 


2110 
2120 
2130 C 






LOR 


#THENTK 




;VE 


3 . . 


REPL. GOTO ev THEN 1 


0307- 


H4 


59 


UTTE 


XT 


LOV 


*CiUTIND 




;COPV TEXT 


rHRRRCTEP 


TO 


OU 


e3C9- 


91 


2R 


2140 






STR 


COUTPTR:) ,V 


















a3CB- 


35 


5C: 


2150 






STR 


*PRVCiUT 




jSRVE RS PREVIOUS OUTPUT 


c 


escD- 


E6 


59 


2160 
2170 ; 
2 1 80 






INC 


*CiUTIND 




; BOOST 


3UTPUT TEXT INDEX 


. 


e3C;F- 


C9 


22 






CMP 


»"■ 






JR 


BRSIC QUOT COPIED 


7 




03D1- 


00 


04 


2190 

2200 ! 

2210 






BNE 


CKEND 




sNO 




CONTINUE 








0303- 


45 


5B 






EOR 


♦OTFLRG 




.:SET BR 


SIC 


"lUOT 


FOUND FLAG | 


03D5- 


95 


5« 


2230 .; 
2240 C 






STR 


♦QTFLRG 




;T0 


EITHER ON OB 


OFF 






0307- 


1=15 


5C: 


KENO 




LDR 


*PRVOUT 




.lEND-OF 


-LINE REACHED 


7 




0305- 


DO 


9D 


2250 
2260 J 
2276 ,! 
2230 ; 
2290 C 






BNE 


SCRN 






.:N0 




CONTINUE 


SCAN. 










OUTF- 


JT TEXT LINE CLEANUP 


















03OB- 


CO 


05 


LERNUP 


CPV 


#5 






;RNV OUTPUT 


LINE 


CHRRRCTER 


03DO- 


90 


11 


2300 
2310 .: 
2320 .! 






BCC 


NEXT IN 




..NO 


... 


DELETE LINE. 















CRRRV SET 




























2330 : 




























e30F- 


R6 


SR 


2340 






LDX 


*CiUTSEG 




;flNV OUTPUT 


LINE 


SEGMENT 


c 


e3El- 


D0 


04 


2350 






BNE 


NEXTOUT 




!VE 


5 . . 


VALID LINE. 












2360 ; 




























03E3- 


38 




2370 DELCHR 


DEV 


- 






sDELETE 


LAST OUTPUT 


CHARAC 1 


03E4- 


3fH 




2380 






TXfl 


- 




















03E5- 


91 


2R 


2390 






STfl 


<OUTPTR>.,V 
























2400 1 




























03E7- 


98 




2410 NEXTOUT 


TVR 


- 




















03E8- 


65 


2R 


2420 






RDC 


*ClUTPTR 




^WITH CflRRV 


SET 


= <fl>+l+ 


OU 


03Efl- 


35 


2fl 


2430 






STR 


*OUTPTR 


















aSEC- 


90 


02 


2440 






sec 


NEXT IN 


















esEE- 


E6 


2B 


2450 






INC 


*0UTPTR+1 
























2460 ; 


































2470 ; 


GET 


THE NEXT BASIC 


INPUT LINE 


POINTER. 


















24S0 ; 




























03F0- 


1=15 


56 


2490 NEXT IN 


LDR 


•NXTLIN 


















e3F2- 


H4 


57 


2500 






LDV 


•NXTLIN+1 
























2510 ; 




























03F4- 


18 




2320 






CLC 






















a3F5- 


90 


Rl 


2530 






BCC 


NEXTLINJ 




^RND CONTINUE SQUEEZING. 










2540 ; 


































2550 






.EN 






















Listing 2: Version for BASIC 1.0 






Listing 3. 


Version for BASIC 3.0 






Original ROM 












Upgrade ROM 














060 


R9 


01 


85 7C 


RO 


04 


34 


7D 


000 


R9 


01 


85 


2R 


RO 


04 


84 


2B 


088 


85 


06 


84 R7 


R0 


00 


R2 


00 


008 


S5 


54 


84 


55 


RO 


00 


R2 


00 


010 


Bl 


R6 


51 7C 


99 


R8 


00 


96 


1 


Bl 


54 


91 


2R 


S3 


56 


00 


36 


1 8 


RC 


l:S 


CO 04 


90 


F2 


84 


RR 


018 


5R 


C8 


CO 


04 


90 


F2 


84 


58 


020 


84 


RB 


RO 01 


Bl 


7C 


D0 


16 


020 


84 


59 


RO 


01 


Bl 


2R 


DO 


16 


028 


H2 


05 


R4 7D 


R5 


7C 


69 


Ol 


028 


R2 


05 


R4 


2B 


R5 


2R 


S3 


01 


030 


30 


01 


08 34 


7C 


CR 


95 


7C 


030 


90 


01 


C8 


94 


2R 


CR 


95 


2R 


038 


Cfi 


10 


F8 4C 


30 


C4 


R4 


f\f\ 


038 


CR 


10 


F8 


4C 


42 


C4 


R4 


58 


040 


Bl 


R6 


E6 RR 


R6 


RD 


DO 


45 


040 


Bl 


54 


E6 


58 


fte 


5B 


DO 


45 


048 


C.9 


20 


F0 F2 


C9 


8F 


DO 


Ol 


043 


C9 


20 


FO 


F2 


C9 


8F 


DO 


Ol 


050 


SR 


CS 


3R DO 


OB 


86 


RF 


R4 


050 


SR 


C9 


3R 


DO 


OB 


86 


5D 


R4 


058 


HC 


FO 


E3 CR 


86 


RC: 


90 


R8 


05S 


5R 


FO 


E3 


CR 


86 


5R 


90 


RS 


060 


Hfl 


F0 


2R E6 


RC 


R4 


RE 


C9 


060 


RR 


FO 


2R 


E6 


5R 


R4 


5C 


C9 


068 


SB 


DO 


02 85 


RF 


C9 


CB 


DO 


068 


SB 


DO 


02 


85 


5D 


C9 


CB 


DO 


070 


02 


Rl=» 


89 C9 


R4 


DO 


08 


CO 


070 


02 


ft-3 


89 


C9 


R4 


DO 


08 


CO 


078 


8 '3 


F0 


C3 CO 


R7 


FO 


BF 


ae 


078 


S9 


FO 


C3 


CO 


R7 


F0 


BF 


R6 


080 


OF 


F0 


0R C9 


S9 


DO 


06 


C0 


080 


5D 


FO 


OR 


C9 


89 


DO 


06 


CO 


088 


fl7 


FO 


B3 fiS 


R7 


R4 


RB 


91 


088 


R7 


FO 


B3 


R9 


R7 


R4 


59 


91 


0'3O 


7C. 


85 


RE E6 


RB 


C9 


22 


DO 


090 


2R 


85 


5C 


E6 


59 


C9 


22 


DO 


0L=»8 


04 


45 


RD 85 


RD 


R5 


RE 


DO 


098 


04 


45 


5B 


S5 


5B 


R5 


5C 


DO 


0fl0 


9D 


CO 


05 90 


11 


R6 


RC 


DO 


ORG 


9D 


CO 


05 


90 


11 


fl6 


5R 


DO 


0FIS 


04 


88 


SR 91 


7C 


98 


65 


7C 


0RS 


04 


88 


8R 


91 


2R 


98 


65 


2R 


0BG1 


85 


7C 


90 02 


E6 


7D 


R5 


R8 


0B0 


85 


2R 


90 


02 


E6 


2B 


R5 


56 


0B3 


fi4 


R9 


IS 90 


Rl 








0B8 


R4 


57 


IS 


90 


Rl 


tucao \ 



Our Current 
Best-Seller 



i\iax> 

on the Apple 



Volume^ 



INCLUDES I 
DISKETTE I 




$24.95 = 



More than 40 new programs on 
diskette to help you get more from 
your Apple: 

• Machine-Language Aids 

• I/O Enhancements 

• Applesoft Aids 

• Graphics and Games 

• Reference Information 

19 choice articles 

43 tested programs on disltette 

(16 sector DOS 3.3 format) 

Volumes 1 & 2 also available at $24.95' 

Together MICRO on the Apple 1, 

2, & 3 provide more than 110 pro- 
grams on diskette for less than 
$1.00 each. No need to type in 
hundreds of lines of code. 

MICRO makes it easy to order: 
Send check (payable to MICRO) to: 

MICRO INK 

P.O. Box 6502 
Chalmstard, MA 01824 

Call our toli-lree number: 

1-800-345-8112 

(In PA, 1-800-662-2444) 
VISA and MasterCard accepted 

Also available at your local computer store. 

*Add $2.00 shipping per book. 
MA residents add 5%. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



45 



Skyles Electric Works Presents 




The VicTree'" 



. . .Leaves your new Vic (or CBM 64) with 35 additional commands. 
. . .Branches out to most BASIC 4.0 programs. 
. . . Roots into most printers. 

Hew from Skyles: the VicTree, a coordinated hardware and software package that allows your Vic 
to branch out in unbelievable directions and makes it easier than ever to do BASIC programming 
debugging and to access your disk. And the new VicTree provides routines to interface the Vic to 
the powerful ProMet local network. 8kb of ROM — 4kb for the BASIC commands, 4kb for disk 
commands and interfacing to ProMet — plus 4kb of RAM for miscellaneous storage. Perfect not 
only for the new Vic but also for the Commodore 64. Unbelievably simple to use and to install, th< 
VicTree gives you all the additional BASIC 4.0 commands to allow most BASIC 4.0 programs to 
work on your new Vic or CBM 64. 

Mow only $89. 95... or $99.95 complete with Centronics standard printer cable. (Cable alone 
$ 19.95.) Available now from your local dealer or order through your Visa or MasterCard toll free: 

(800) 227-9998 (California, Canada, Alaska, Hawaii: (415) 965-1735) or send check or 

money order directly to: 




Skyles Electric Works 



231 E South Whisman Road 
Mountain View, CA 94041 
(415)965-1735 



46 



MICRO - The 6502/6809 Journal 



No. 55 - December 19J 



commodore 



BASIC Line Delete 
for PET/CBM and VIC 



by Thomas Henry 



Use this convenient utility 
during your BASIC program 
development. It allows you to 
delete a whole range of lines, 
rather than just one at a time. 

BASIC Line Delete 

requires; 

Upgrade or 4.0 PET/CBM 
or VIC 



"BASIC Line Delete," a command you 
can add to your Commodore computer's 
resident BASIC, deletes blocks of 
BASIC lines instantly. For example, 
suppose you wish to delete line num- 
bers 1000 through 5000 in a BASIC pro- 
gram. Simply type " < 1000-5000" and 
hit [return] and all those lines will be 
deleted instantly! This BASIC Line- 
Delete function is easy to use since the 
syntax is the same as that found for the 
LIST command. In addition, extensive 
error checking is employed to avoid 
disasters. 

You can consider BASIC Line 
Delete as an addition to the computer's 
BASIC language. It is loaded into the 
computer at the start of a session and 
can be invoked at any time, in the im- 
mediate mode, to perform its task. 
Because this 177 byte-long machine- 
language program sits at the top of 
memory with memory pointers 
lowered accordingly, it can peacefully 
coexist with any BASIC program. 

The original program was written 
on a CBM-8032 with 4.0 ROMs. How- 
ever, it should be easy to convert to any 
type of Commodore computer since the 
ROM routines used are common to all 
models — only the addresses are dif- 
ferent. In addition, it is likely that 
other Microsoft BASIC machines can 
use this program with a few changes. 
When we examine the ROM routines 
you will note that they are routines 
that any BASIC interpreter must have. 

VIC-20 owners shouldn't feel left 
out either. Even though the program is 
in machine language, the VIC-20 can 



still use it simply by employing a 
BASIC loader that POKEs the required 
data into memory. I will present a pro- 
gram to do this later in the article. 

Even if you don't want or need a 
BASIC Line Delete, you may want to 
look ov€r the program description any- 
way. Several interesting routines are 
presented that could be put to other 
uses. In addition, you may want to see 
how the program implements error 
checking and apply it to your own work. 

Format of the New Command 

To get a feel for how the program 
works, let's examine how it should 
look to the user. The "<" sign in- 
dicates the function, although other 
keys could be used by making one 
small change in the program. As men- 
tioned before, the format is identical to 
that used for the LIST command. Let's 
summarize all proper uses of the BASIC 
Line Delete: 



Proper 


Impiopei 


< 100-200 


< 


<100- 


<- 


<-200 


<100 




<- 




etc. 



The first statement under proper syn- 
tax will delete lines 100 through 200 
inclusive. The second one will delete 
all statements from 100 on. The last 
one will delete all statements up to line 
200 inclusive. And just like the LIST 
command, there doesn't have to be any 
line number 100 or 200 for this to 
work. Suppose the first line number 
past 90 in your program is actually 122 
and the last one before line 210 is 186. 
Then "< 100-200" will still delete all 
of the lines between this range, mean- 
ing that actually lines 122 through 186 
are deleted. 

The second column shows some of 
the possible statements with improper 



Figure 1 How BASIC Is Stored and Principle of DELETE 



LINES 

TO BE 

DELETED 





FORWARD 
LINK 


LINE 
NUMBER 


END OF 
LINE SIGN 




LO 
BVTE 


HI 
BVTE 


LO 
BVTE 


HI 
BVTE 


TOKENIZED AND COMP'RESSED BASIC LINE 


C 




















*• 


A 


































V. 


B 

















END OF 
BASIC SIGN 







(2) 



(3) 



(4) 



(5) 



(6) 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



47 



commodore 



syntax. If you type any of these, the 
operation will be aborted and a "?SYN- 
TAX ERROR" message will be returned. 
It is important to have this feature 
since a delete function could have 
potentially catastrophic results if 
improperly used. So, essentially the 
statements shown in column one all 
have proper syntax and will produce 
meaningful results from the computer, 
while all other statements will not 
execute and will produce a syntax error 
message. 

If the range is "backwards" (e.g., 
<200-100), an error message will again 
be produced. Finally, I feel so strongly 
about error checking that I incor- 
porated one more feature. After enter- 
ing a valid delete command, the com- 
puter will respond with "ARE YOU 
SURE?", giving you one last chance to 
change your mind! This feature is only 
available to users with 4.0 operating 
systems since the "ARE YOU SURE?" 
routine is part of the normal SCRATCH 
and HEADER commands. 



About the Piogiam 

Figure 1 illustrates the principle. As 
you probably know, a BASIC line is 
stored in the computer in a specific 
form. As shown in the illustration, two 
bytes are devoted to storing the forward 
link address, which is nothing more 
than a pointer to the following line in 
memory. The next two bytes contain 
the line number. The next area, vari- 
able in size, contains the compressed or 
tokenized BASIC statement. This is 
polished off with a zero byte to indicate 
the end of a line. This format is fol- 
lowed throughout memory until the 
last line is hit. A pair of zeros is in- 
cluded at the end of the last line to in- 
dicate the end of the program. (Actually 
there are three zeros here, if you count 
the normal end-of-the-line zero). Sup- 
pose we wish to delete lines 3 and 4 as 
indicated in figure 1. What we will do 
is pick up everything from point B to 
the end of BASIC and put it back down 
again at point A. Lines 3 and 4 will be 
written over in this step. At this point 
we have just transferred some memory. 
The link addresses will now be all wrong 
for the new locations. Fortunately, 
there is a routine in the ROMs that will 
rebuild the link addresses for us auto- 
matically. After this routine is called 
the delete has been performed and the 
BASIC program is all set to go again! 

Figure 2 is an assembler listing of 
the BASIC Line Delete program. As 
mentioned above, the error checking is 
the only hard part of the program; the 



Figure 2 



00001 


0000 






; *********************************** 


00002 


0000 






;* 




* 


00003 


0000 






;* BASIC LINE DELETE 


UTILITY ♦ 


00004 


0000 






!♦ 




* 


00005 


0000 






;♦ ASSEMBLER CODE FOR 


CBM-8032 ♦ 


00006 


0000 






; * 


THOMAS HENRY ♦ 


00007 


0000 






;* 




* 


00008 


0000 






; *************** ******************** 


00009 


oooo 






; 






00010 


0000 






; 






00011 


0000 






VALUE 


= «11 


INTEGER VALUE. 


00012 


0000 






VARBLE 


= «2A 


POINTER TO VARIABLES. 


00013 


0000 






MEMTOP 


= «34 


TOP OF MEMORY POINTER. 


O0014 


0000 






SAVE 


= «59 


SAVE START ADDRESS. 


00015 


0000 






ADDRES 


= «5C 


ADDRESS OF FOUND LINE ». 


00016 


0000 






CHR6ET 


= «70 


BASIC CHRGET ROUTINE. 


00017 


0000 






CHR60T 


= «76 


BASIC CHRSOT ROUTINE. 


O0018 


0000 






POINTR 


= «77 


CHRGET POINTER. 


00019 


0000 






WEDGE 


= «79 


WEDSE SOES HERE. 


O0020 


0000 






RETURN 


= «7D 


RETURN TO CHRGET ROUTINE. 


00021 


0000 






FIXUP 


= «B4AD 


ADJUST POINTERS. 


00022 


0000 






CHAIN 


= «B4B6 


REBUILD LINE CHAINING. 


00023 


0000 






SEARCH 


= «B5A3 


SEARCH FOR BASIC LINE. 


00024 


0000 






INTESR 


= «B8F6 


FETCH INTEGER INPUT, 


00025 


0000 






ERROR 


= «BF00 


SYNTAX ERROR ROUTINE. 


00026 


0000 






QUERY 


= «DB9E 


'ARE YOU SURE?" 


00027 


0000 






CHROUT 


= «E202 


PRINT CHARACTER TO SCREEh 


00028 


0000 






; 






00029 


0000 






; 






00030 


0000 








« = »7F52 




00031 


7F52 






; 






00032 


7F52 


A9 


4C 


SETUP 


LDA #«4C 


OP-CODE FOR "JMP'. 


00033 


7F54 


85 


79 




STA WED6E 




00034 


7F56 


A9 


63 




LDA #< ENTRY 


LOW BYTE OF ENTRY. 


00035 


7F58 


85 


34 




STA MEMTOP 


LOWER MEMORY TO PROTECT. 


00036 


7F5A 


85 


7A 




STA WEDSE+1 




00037 


7FSC 


A9 


7F 




LDA W>ENTRY 


HIGH BYTE OF ENTRY. 


00038 


7F5E 


85 


35 




STA MEMTOP+1 


LOWER MEMORY TO PROTECT. 


00039 


7F60 


85 


7B 




STA WEDeE+2 




00040 


7F62 


60 






RTS 


INITIALIZATION COMPLETE. 


00041 


7F63 






; 






00042 


7F63 






; 






0O043 


7F63 


C9 


3C 


ENTRY 


CMP #'< 


LOOK FOR DELETE SYMBOL. 


00044 


7F65 


DO 


08 




BNE COMMON 


SORRY, NOT HERE. 


00045 


7F67 


48 






PHA 


;YES, IT'S HERE. SAVE. 


00046 


7F68 


A5 


77 




LDA POINTR 




00047 


7F6A 


C9 


00 




CMP #«00 


; CHECK FOR IMMEDIATE MODE 


00048 


7F6C 


FO 


09 




BEQ DELETE 


;D0 DELETE IF IMMEDIATE. 


00049 


7F6E 


68 






FLA 


; DON'T DO IN PROGRAM MODE 


0O050 


7F6F 


C9 


3A 


COMMON 


CMP »«3A 


COMPLETE CHRGET ROUTINE. 


00051 


7F71 


90 


01 




BCC FINISH 




00052 


7F73 


60 






RTS 




00053 


7F74 


4C 


7D 00 


FINISH 


JMP RETURN 




00054 


7F77 






; 






0OO55 


7F77 












00056 


7F77 


20 


70 00 


DELETE 


JSR CHRSET 


: FETCH FIRST CHARACTER. 


00057 


7F7A 


90 


OD 




BCC FIRST 


; IT'S A NUMBER. 


00058 


7F7C 


FO 


IE 




BEQ MIDDLE 


JNULL INPUT IS ERROR. 


00059 


7F7E 


C9 


2D 




CMP #'- 


:IS IT A MINUS SIGN-? 


00O60 


7F80 


DO 


IE 




BNE BYPASS 


;N0, ERROR' 


00061 


7F82 


20 


70 00 




JSR CHRSET 


; FETCH NEXT CHARACTER. 


00062 


7F85 


C9 


2D 




CMP #'- 


SIS IT ANOTHER MINUS SIGN 


00063 


7F87 


FO 


73 




BEQ BAD 


;IF IT IS, THEN ERROR. 


00064 


7F89 


20 


F6 B8 


FIRST 


JSR INTEGR 


; ACCEPT INTEGER INPUT. 


00065 


7F8C 


20 


A3 B5 




JSR SEARCH 


;FIND THE LINE NUMBER, 


00066 


7F8F 


A6 


5C 




LDX ADDRES 


;AND SAVE ITS ADDRESS. 


00067 


7F91 


A4 


5D 




LDY ADDRES+1 




00068 


7F93 


86 


59 




STX SAVE 




00069 


7F95 


84 


5A 




STY SAVE+l 




00070 


7F97 


20 


76 00 




JSR CHRSOT 


;LOOK AGAIN AT CHAR. 


00071 


7F9A 


90 


13 




BCC LAST 


;G0 GET LAST LINE NUMBER. 


00072 


7F9C 


FO 


5E 


MIDDLE 


BEQ BAD 




00073 


7F9E 


C9 


2D 




CMP »'- 


; IS IT A MINUS SIGN? 


00074 


7FA0 


DO 


3A 


BYPASS 


BNE BAD 


,-NO, ERROR! 


00075 


7FA2 


20 


70 00 




JSR chrse:t 


;YES, fetch NEXT CHAR. 


00076 


7FA5 


DO 


08 




BNE LAST 


; IF PRESENT, GO ON. 


00077 


7FA7 


A2 


FF 




LDX #«FF 


; OTHERWISE DEFAULT TO 


00O78 


7FA9 


86 


11 




STX VALUE 


SLINE NUMBER tFFFF. 


00079 


7FAB 


86 


12 




STX VALUE+1 




00080 


7FAD 


DO 


03 




BNE DEFALT 


; BRANCH ALWAYS. 


00081 


7FAF 


20 


F6 B8 


LAST 


JSR INTEBR 


;GET LAST LINE ». 


00082 


7FB2 


20 


A3 B5 


DEFALT 


JSR SEARCH 


;FIND ADDRESS OF LINE #. 


00083 


7FB5 


90 


OC 




BCC CHECK 


; BRANCH, LINE NOT FOUND. 


00O84 


7FB7 


AO 


00 




LDY #«00 




00085 


7FB9 


Bl 


5C 




LDA ( ADDRES ),Y 


;Lltl FORWARD LINK TO 


00086 


7FBB 


AA 






TAX 


;POINT TO NEXT LINE IN 


00087 


7FBC 


C8 






INY 


; MEMORY. 


00088 


7FBD 


Bl 


5C 




LDA (ADDRES), Y 




00089 


7FBF 


86 


5C 




STX ADDRES 




00090 


7FC1 


85 


5D 




STA ADDRES+1 




00091 


7FC3 


38 




CHECK- 


SEC 


; CHECK TO SEE THAT THE 


00092 


7FC4 


A5 


5C 




LDA ADDRES 


; START NUMBER IS LOWER 


00093 


7FC6 


E5 


59 




SBC SAVE 


;THAN THE STOP NUMBER. 



48 



MICRO - The 6502/6809 Journal 



No. 55 - December 19J 



commodore 



Figure 


2 (continued) 












00094 


7FCS 


ft5 


5D 






LDA 


ADDRES+1 




00095 


7FCft 


E5 


5A 






SBC 


SAVE+1 




00096 


7FCC 


90 


2E 






BCC 


BAD 


; IT'S NOT, SO ERROR. 


00097 


7FCE 


20 


9E 


DB 




JSR 


QUERY 


i IT IS. LAST CHANCE 


00098 


7FD1 


BO 


21 






BCS 


DONE 


;T0 CHANGE YOUR MIND. 


00099 


7FD3 


ftO 


OO 




MOVE 


LDY 


#»00 




OOIOO 


7FD5 


Bl 


5C 






LDA 


(ADDRES).Y 


; SHIFT BYTES BACK, 


00101 


7FD7 


91 


59 






STA 


(SAVE),Y 


;ONE BY ONE. 


0O102 


7FD9 


E6 


59 






INC 


SAVE 


INCREMENT START ADDRESS. 


00103 


7FDB 


DO 


02 






BNE 


NOCARl 




00104 


7FDD 


E6 


5ft 






INC 


SAVE+1 




00105 


7FDF 


E6 


5C 




NOCARl 


INC 


ADDRES 


; INCREMENT END ADDRESS. 


00106 


7FE1 


DO 


02 






BNE 


N0CAR2 




00107 


7FE3 


E6 


5D 






INC 


ADDRES+1 




00 108 


7FE5 


A5 


5C 




NDCAR2 


LDA 


ftDDRES 


; IS END ADDRESS TOUCHING 


00109 


7FE7 


C5 


2A 






CMP 


VARBLE 


;THE START OF VARIABLES YET? 


00110 


7FE9 


DO 


E8 






BNE 


MOVE 


;IF IT ISN'T, DO MORE. 


00111 


7FEB 


A5 


5D 






LDA 


ADDRES+1 




00112 


7FED 


C5 


2B 






CMP 


VARBLE+1 




00113 


7FEF 


DO 


E2 






BNE 


MOVE 




00114 


7FF1 


20 


B6 


B4 




JSR 


CHAIN 


JREBUILD CHAINING OF LINES. 


00115 


7FF4 


ft9 


OD 




DONE 


LDA 


««0D 


; PR I NT CARRIAGE RETURN. 


00116 


7FF6 


20 


02 


E2 




JSR 


CHROUT 




00117 


7FF9 


4C 


AD 


B4 




JMP 


FIXUP 


; CLEAN UP POINTERS, ETC. 


00118 


7FFC 


4C 


00 


BF 


BAD 


JMP 


ERROR 




00119 


7FFF 










.END 





delete part is quite easy. I will let you 
examine the assembler listing, but as 
an aid to understanding, let me 
describe the key ROM routines used in 
it. You may want to jot these down in 
your notebook for future reference, 
since I'm sure these routines have 
many more valuable uses. 

The routine at $B8F6 will get an in- 
teger from the screen. The CHRGET 



routine (at $70) is called first and this 
causes locations $77 and $78 to point 
to the start of the integer (which is in 
ASCII). After a fSR $B8F6, the ASCH 
representation is converted to a binary 
form and the result is deposited in loca- 
tions $11 and $12 (low byte and high 
byte, respectively). If $77 and $78 point 
to the "-" sign (as in the command 
"<-200"), the subroutine will return 



with zeros in $11 and $12. You can con- 
sider this as a default lower line number. 

Given a line number, routine 
$B5A3 will find where in memory that 
BASIC line sits. Simply put the desired 
line number in locations $11 and $12 
and call rovitine $B5A3. The routine 
will return v/ith the address of the first 
byte of the desired line in locations $5C 
and $5D. You will note that the routine 
described in the preceding paragraph 
ends with the desired data in locations 
$11 and $12, whereas this routine 
begins with data in these locations. 
This means that we can chain the two 
routines without saving any inter- 
mediate results! 

An interesting feature of this line- 
finding routine is its ability to adapt to 
non-existent line numbers. For exam- 
ple, suppose you tell it to find line 100 
but no such number exists in your pro- 
gram. However, your program does 
contain a statement with line number 
110. When you call the routine it will 
look for number 100 and won't find it. 
But it will continue to look for the first 
line number beyond 100 (in this case 
110) and return with its address in- 



MIDNITE 

SOFTWARE GAZETTE A 



The 

PAPER 



Five years of service to the PET community. 

© 



c 










GO 




1 Ri 



m 



The Independent U.S. magazine for 
users of Commodore brand computers. 

EDITORS: Jim and Ellen Strasma 
Sample Issue free on request, from: 

635 MAPLE n MT. ZION, IL 62549 USA 



"■•"CQiDPU 5Ef\i5Ei:.'' 

CARDC Products For the Vic-20® 

VIC-20* is a registered tradem.3rk of Commodore. 

CARDBOARD 6 Expand your Vic-20® to accept 6 game 
cartridges or an additional 35K of RAM memory. Until De- 
cember 1 5, 1 982, a SPECIAL CHRISTMAS PRICE $79.95, 
thereafter $99.95 

CARDBOARD 3 An economy memory expanderto 35KAM 
or 3 game cartridges $29.95 

CARDPRINT Printer interface— Vic to Centronics type 
parallel input printer. This unit uses the regular Vic printer 
out put port and uses normal Vic print commands $79.95 

CARDRITER A light pen with 6 software programs includ- 
ing a full screen drawing tablet, a light pen instruction pro- 
gram, and some games $29.95 

Cardette universal cassette interface for the Vic. Allows any 
standard cassette player/recorder to be used In place of the 
Vic Dattasette, $29.95 

We carry a full line of Vic-20® hardware and software. We 
have a full line of other software including the exciting NEW 
SOFT$EN$E LINE of Small Business or personal business 
programs. 

SEND FOR OUR CATALOG 

To Order: 

P.O. Box 18765 

Wichita, KS 67218 

(316) 684-9660 

Personal Checks Accepted (Allow 3 Weeks), or C.O.D. 

Handling Charges $1 .50 

Prices Subject to Change without notice 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



49 



commodore 



stead. You can see that this is exactly 
what the BASIC Line Delete program 
needs! One other feature is that if the 
exact line number specified was found, 
then the carry flag is set. Otherwise, as 
in our example here, the carry flag will 
be cleared. 

In the program, if no last line 
number is specified, a default number 
of $FFFF (65535 decimal) is specified. 
Notice what happens when this 
number is acted on by subroutine 
$B5A3. Suppose the actual last number 
in your BASIC program is 1000 and you 
enter the command "<250-". The 
default number $FFFF is loaded into 
$11 and $12 and routine $B5A3 is 
called. The routine will start with 
65535 and will whittle away at the 
numbers until it eventually hits your 
actual last number (1000 in this case). 
Once again, this is exactly what the 
BASIC Line Delete requires. 

The routine at $DB9E will query 
"ARE YOU SURE?" and wait for a re- 
ply. If the answer is "Y" or "YES" the 
carry flag will be cleared. Any other 
response will set the carry flag. Note 



VIC-20 



J 



VIC-20 INTERFACING BLUE BOOK 

Did you know that your VIC can be used loh* 
control a 990; toy motor so effectively that it ~ 
runs like a precision machine? Or that you can 
build an accurate digital thermometer using 
the VIC and four other parts costing less than 

These and other 18 interfacing projects ^ 
selected for usefulness, ease of construction 
and low cost are detailed in the VIC-20 Inter- 
facing Blue Book, a veritable gold mine of prac- 
tical information on how to build a variety of in- 
terfaces for your computer. 

Projects include: Connecting VIC to your 
stereo: Pickproof digital lock; Capacitance 
meter; Liquid level ■sensor; Telephone dialer: 
Voice output: 8Kyi6K RAM/ROM expansion; 
128K RAM expansion; 8-bit precision D/A; 8-bit 
A/D converter; MX-80 printer interface and 
more- 

Wntten by a college professor in a friendly 
and informative style, the Blue Book gives you 
theory of operation, schematics, program 
listings, parts list, construction hints and 
sources of materials for each one of the 20 pro- 
jecls- 

11 you want lo get the most out o1 your VlC 
this book is a must. Even if you don't plan to 
build any of the projects, the Blue Book is a 
valuable source of information on what can be»_ 
done with the VIC- Cost is $14.95 (less than 75« |9 
per project!). 
WORD WHIZ 

Here is a no-frills word processor that does 
the job and is so small it leaves plenty of 
memory for your text. Yet if oHers full screen C 
editing and easy save of work in progress on 
cassette, by taking advantage of VIC'S built-in 
text manipulation capabilities. WORD WHIZ-^ 
prints out on the 1515 printer and is a bargain ^ 
at $9.95, 
WORD WHIZ/eO 

For classy looking output, this version of 
WORD WHIZ will drive an EPSON f^X-80 (See 
Interlacing info in Blue Book above). Gel letter 
quality printing for only $14.95. 

Above prices include postage in the 
>j U.S. CA res. add 6% tax. Foreign add $2. 

I mlch-DsignBl 

900 Embarcadero Del Mar, Unit A| 
Golela, CA93117 



in add $2. j 



Figure 3 



100 REM tttttttttttttttttttttttttttttttttttttttti 

110 REM » 

120 REM t BfiSIC LINE DELETE: 

130 REM « VIC-20 VERSION 

140 REM t 

150 REM » THOMAS HENRY 

160 REM t 

170 REM t TRANSONIC LABORATORIES 

180 REM « 249 NORTON STREET 

190 REM t MANKATO, MN 56001 

20O REM t 

210 REM tttttttttttttttttttttttttttttttttttttttt* 

220 REM 

230 REM 

240 PRINT"WAIT A MOMENT..." 

250 X=PEEK(55)+256«PEEK(56)-163 

260 FORA=X TO X+162 

270 READD:POKEA,D:NEXT 

280 Y=X+17:H7.=Y/256:L=Y-256»H7. 

290 P0KEX+S,L:P0KEX+11,H7. 

300 SYS (X): NEW 

310 DATA169,76, 133, 124, 169, llO, 133.55, 133, 125, 169,29, 133.56, 133, 126 

320 DATA96,201,60,208,8,72, 165, 122,201,0,240,9, 104,201,58, 144 

330 DATA1,96,76, 128,0,32, 115,0, 144, 13,240, 116,201,45,208, 112 

340 DATA32, 115,0,201,45,240, 105, 32, 107, 201 , 32, 19, 198, 166, 95, 164 

350 DATA96. 134,92, 132,93,32, 121,0, 144, 19,240,84,201,45,208,80 

360 DATA32, 115,0,208,8, 162,255, 134,20, 134,21,208,3,32, 107,201 

370 DATA32, 19, 198, 144, 12, 160, O, 177, 95, 170,200, 177, 95, 134, 95, 133 

380 DATA96,56, 165,95,229,92, 165,96,229,93, 144,36, 160,0, 177,95 

390 DATA14S, 92, 230, 92, 208, 2, 230, 93, 230, 95, 208, 2, 230, 96, 165, 95 

400 DATA197,45,208,232, 165,96, 197,46,208,226,32,51, 197,76,42, 197 

410 DATA76,S,207 



that due to a quirk in this routine, you 
should print a carriage return to the 
screen following it. This will move the 
cursor to the proper position on the 
next line. To print a carriage return, do 
the following: 

LDA #$0D 
JSR $E202 

To rebuild the forward link chain- 
ing, simply call subroutine $B4B6. No 
set-up is needed to enter this routine. 

The BASIC Line Delete program 
ends with two alternate ways to get 
back into BASIC. If JMP $B4AD is 
used, then a graceful return will be 
made to BASIC, indicating that all 
went well. However, if a return is made 
via JMP $BFOO, the statement "SYN- 
TAX ERROR" will be printed in- 
dicating that the attempted operation 
was aborted. 

To round out your survey of this 
program note that locations $59 and 
$5A hold the address of the start line 
number (where the later memory will 
be moved tO; "A" in figure IJ. $5C and 
$5D hold the address of the end line 
("B" in figure 1). $2A and $2B are 
pointers to the end of BASIC. 

How to Load and Use the Piogiam 

If you have a computer other than 
4.0, you will have to make the required 
translations to your machine. If you 
have memory maps handy this 
shouldn't take too long. I was able to 
make a VIC-20 version in about fifteen 



minutes simply by comparing memory 
maps. Just enter the resident machine- 
language monitor and list out the re- 
quired lines with the command: 

.M 7F52,7FFF 

Now type over what the computer 
shows, using the byte values generated 
in the assembly in figure 2 as a guide. 
When you are done, save the program 
with the command: 

.S "DELETE - 32594",08,7F52,7FFF 

If you are saving to tape replace the 
"08" with an "01". The number in the 
title is the SYS number. 

Suppose you are using the program 
at the start of a session (from a cold 
start]. First LOAD the program in the 
normal way (just like a BASIC 
program). There is no need to load it 
from the monitor,- the CBM-8032 
knows where to put it. Next type NEW 
and hit return. This step is important 
since it resets some pointers previously 
disanayed by the LOAD command. 
Now type SYS32594 and hit return. 
The BASIC Line Delete is now ac- 
tivated. The top of memory pointers 
are automatically lowered to protect it. 
You are now free to call up the function 
whenever desired. 

This program is very relocatable. If 
you decide to put it somewhere else in 
memory only locations $7F57 and 
$7F5D need be changed. These two 
bytes form the address of the CHRGET 



50 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



commodore 



Add-on, starting at $7F63 in this case. 
Everything else remains the same. This 
is due to extensive use of relative ad- 
dressing; there are no internal JSR or 
JMP commands to be altered. Simply 
transfer the program, change the two 
bytes mentioned, and run it using the 
new SYS address! 

VIC-20 owners need a different way 
to get the program into memory since 
the VIC has no resident machine- 
language monitor. Figure 3 shows a 
loader program that will enter an 
equivalent BASIC Line Delete into 
memory. Note that this loader is com- 
pletely automatic since it not only 
loads the program but also instantly ad- 
justs to VIC-20S with any amount of 
add-on memory. In addition, the pro- 
gram automatically does a SYS to the 
right address. All the user has to do is 
LOAD the program and RUN it! 

Now you have a new command for 
your Commodore computer. You don't 
really have to understand how it works 
to use it, but I recommend you look 
over the assembly listing again. As 
mentioned before, the ROM routines 



called are quite powerful and probably 
have many other uses. In addition, the 
program itself could serve as an exam- 
ple of how to incorporate worst-case er- 
ror checking into your own routines. 

Acknowledgements 

I owe a big debt of gratitude to Dick 
Iramers of the Central Illinois PET 
User's Group for explaining some of 
the quirks of the CBM-8032 machine- 
language tape-save routine. Thanks 
also go to Dr. Kenneth Good, Mankato 
State University, for putting early ver- 
sions of this program to the acid test. 
He found several conditions that could 
have caused users real troubles were 
they not flagged with "SYNTAX ER- 
ROR" statements. 



Thomas Henry is a professional writer in 
the areas of electronic music, circuit 
design, and Commodore computers. He 
may be contacted at Transonic 
Laboratories, 249 Norton Street, Mankato, 
MN 5600L 

iMCftO 



70 INCOME 1AX PROGRAMS 

(For Filing by April 15, 1983) 

For APPLE ll/ll* (DOS 3.3, 16-Sector) 



FEATURES:— 

1 . Menu Driven. 

2. 70+ Tax Programs. 

3. Basic: Unlocl<ed: Listable. 

4. Name/SS No./FS carried 
over. 

5. Inputs can be checl<ed. 
8. Inputs can be ctianged. 

7. I.R.S. approved REVPROC 
format. 

8. Prints entire Form/Schedule. 

9. Calculates Taxes, etc. 

10. In 3.3 DOS, 16-Sector. 

1 1 . Fast calculations. 

12. Use GREENBAR in triplicate 
— don't change paper all 
season! 

Our 4th Year in Tax 
Programs. 
We bacl< up our Programs! 



13. 



14 



Helpful programs to calculate and print the many Tax 
Forms and Schedules. Ideal for the Tax Preparer, 
C.P.A. and individuals. For just $24.75 per disl<, post- 
paid (in 3.3 DOS; 16-Sector disl<s). 
Programs are designed for easy-use, with check- 
points to correct parts as needed. Results on screen 
for checking before printing. 

In all, there are more than 70 individual Tax Programs. 
These include Form 1040, 1040A, 1040EZ, 1120, 
1120S, 1041 and 1065. Also Schedules A, B, C, D, E, 
F, G, R, RP and SE. And, Forms 1116, 2106, 2119, 
2210, 2440, 3468, 3903, 4255, 4562, 4797, 4835, 
4972, 5695, 6251 and 6252. 
And, we have a disk we call "THE TAX PREPARER'S 
HELPER " which has programs for INCOME STATE- 
MENTS, RENTAL STATEMENTS, SUPPORTING STATE- 
MENTS, IRA, ACRS, 1040/ES, ADD W-2's and PRINT 
W-2's. 

TRY ONE DISK AND SEE FOR YOURSELF. ONLY $24.75 
POSTPAID. 

First disk is AP#1, and includes Form 1040 and 
Schedules A, B, C, D and G. $24.75 POSTPAID. 



, ^ Write: 

Ifl^l GOOTH TAX PROGRAMS 

931 So. Bemiston • St. Louis, Mo. 63105 



VKA^ 



Aharvestof 
savings from 




Electronics 



SOFEWUIE 



APPIE ' ATARI 'TRSaO' IBM 

A full line erf software for business, games 
^Ki educatKm Up tO 35% Offl 



MUSE 


ICJS 


VlSICOi?P 


STONEWAIRE 


ONLJME 


SlTiEROSnC 


EDa-\M\RE 


HAYDEN 


HOWAF© 


AND /^WIY MORE 



HARDWARE 



AMDEK • HAYES ■ MICROSOFT 

FRANKLIN COMPUTER 

SYSTEM 
ACE 1000 ' $1,795.00 



DISKS 



Maxell BoxoflO,5'4",SS-DD $35.00 
Verbatim Boxof 10,5;4",SS-DD $29.00 



MONTTORS 



LE MONITORS 


Ust 


Our Price 


9" Green 


$189.00 


$159.00 


12" Green 


$199.00 


$169.00 


ZENITH 






12" Green 


$179.00 


$129.00 



Plus a full line of AMDEK Monitors 



PRINTERS 



RAWER TIGER Ust Our Price 



460G 


$1,094.00 


$950.00 


560G 


$1,394.00 


$1,250.00 


EPSON 






MX 70 


$449.00 


$395.00 


MX son" 


$745.00 


$595.00 


Mxioon" 


$945.00 


$795.00 



CALLF(mTHiSM(mnm special! 
l-80{>835 2246 EXT. 211 

OR 

7024594114 



B5130EastCharieslonBlvd. 
Suite 5MI 
Las\fegas,rievada89122 
Phone orders welcome. Mail orders may send 
charge card number (include expiration date), 
cashiers check, money order or pjersonal check 
(allow ten business days for personal or com- 
pany checks to clear). Add S3.00 for shippinq, 
nandling and insurance. Nevada residents add 
5.755& sales tax. Please include phone number- 
All equipment is in factory cartons with manu- 
facturers warranty. Equipment subject to price 
change and availability. Call or write for price list 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



51 



commodore 



SOUP: A CBM Machine-Language 
Compare Program 



by Henry Troup and Jim Strasma 



SOUP is an efficient compare 
program for machine-language 
program files on Commodore 
disk. It uses BASIC 4.0 disk 
commands, but is otherwise 
compatible with other IVIicrosoft 
BASICS. 

SOUP 

requires: 

PET/CBM 
disk drives 
printer (optionai) 

This program, originally adapted by 
Henry Troup from a similar mini- 
computer utility, compares two ver- 
sions of a machine-language program 
on disk and prints out any lines that 
differ between the two versions. All 
you need to use SOUP are disk copies 
of the two machine-language programs 
to be compared. The only other restric- 
tion is that they must begin loading at 
the same address. 

To use the program, place the disk 
or disks with the files to compare in 
your disk unit. Also prepare your 
printer, if you are using one. At start 
up, you will be asked the name and 
drive number of the two files. This is 
the only time in the program that disk 
status is checked. If an error is found 
here, repair the cause and re-enter the 
file name and drive number. 

From here on, operation is automatic. 
As differences are discovered they are 
listed either to the screen or printer. 
You may wish to make some changes 
in the formatting used here. Lines 700 
and 710 set the maximum fields per 
line for screen and printer respectively. 
If your screen has over 40 columns, or 
your printer over 80, you may increase 
the value given to variable mf. Like- 
wise, if your printer is not device #4, 



change lines 690 and 710 to allow the 
device number you need. If your paper 
is not the 11 -inch variety common in 
the U.S., change line 350 to adjust the 
lines printed per page to your needs. 

To better explain its workings, the 
program as printed here is heavily com- 
mented and uses fewer multiple state- 
ment lines than it could. Feel free to 
omit remark statements and lines con- 
taining only a colon; none is referenced 
by other lines. You may also be able to 
combine some lines. For example, the 
subroutine beginning in line 460 could 
be reduced to four lines. Likewise, the 
spaces that are not within quotation 
marks may safely be left outi However, 
you may find it better to leave the pro- 
gram as listed here and compile it. 

In the interest of speeding up the 
program, often-used constants are re- 
placed by variables, seldom-used lines 
are moved to the end of the listing, and 
disk status is left unchecked once the 
needed files are successfully opened. If 
you notice that the program seems to 
have halted with the disk error light on, 
hit the [stop] key, and check the disk 
status in immediate mode: 
?ds$ 



Most likely the error will be fatal, and 
you will have to start over again after 
correcting the problem. 

The program uses only a few special 
characters. In lines 670, 730, 740, 780, 
and 790 notice the three equal signs in 
a row (= = =). These represent three 
[cursor left] characters. These charac- 
ters place the flashing input cursor over 
a likely default answer. They also pro- 
tect the user from accidentally falling 
out of the program. Even so, you may 
omit them. 

To use this program with other 
computers or disk drives, you will need 
only to substitute your disk commands 
for Commodore's. The most difficult 
task for other disk operating systems is 
likely to be reading in the program files 
one character at a time. The other 
essential task is to detect the end of file 
when it is reached. If you know how to 
do these tasks on your machine, you 
can probably make SOUP work for you. 



Henry Troup and Jim Strasma may be 
contacted at 1280 Richland Ave., Lincoln, 
IL 62656. 



Listing 1 


100 


REM SOUP — AS OF 7 SEPT 82 


110 


GOSUB 630:REM PUT MOST-USED LINES AT START FOR SPEED 


120 


REM MAIN ROUTINE 


130 


NM$="S0UP: FILE A="+CF$+" S, FILE B="+PF$:REM TITLE 


140 


PRINT#4,NM$:REM START NEW PAGE 


150 


GETtl,A$:REM READ A CHARACTER FROM FILE A 


160 


S1=ST:REM REMEMBER I/O STATUS OF A 


170 


IF A$=NL$ THEN A$=ZE$:REM TRAP NULL DATA BUG 


180 


GET#1,B$:REM READ A CHARACTER FROM FILE B 


190 


S2=ST:REM REMEMBER I/O STATUS OF B 


200 


IF B$=NL$ THEN B$=ZE$:REM FIX NULL DATA BUG 


210 


IF A$=B$ GOTO 4 20:REM ONLy REPORT DIFFERENCES 


220 


A=ASC(A$) :B=ASC(B$) :REM CONVERT TO DECIMAL CODE 


230 


N=AD:GOSUB 490:RE.M CONVERT ADDRESS TO HEXADECIMAL 


240 


PRINT#4,"@"HX$",A="; :REM PRINT MISMATCH 


250 


N=A:G0SUB 490:REM CONVERT A'S VALUE TO HEX 


260 


PRINTlt4,HX$"+B = "; :REM S. PRINT IT 


270 


N=B:GGSUB 490:REM THEN CONVERT e'S 



52 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Listing 1 (continued) 

280 PRINTH,HX$; :REM & PRINT IT 

290 FC=FC+1:REM PRINT 4 MISMATCHES PER LINE 

3aa REM TAB IF HAVE ROOM FOR ANOTHER ON LINE 

310 IF FC<MF THEN PRINTH," ";:G0TO 420 

320 FC=0:REM ELSE RESET FIELD COUNTER 

330 PRINTIt4:REM & FINISH LINE 

340 LC=LC+1:REM INCREMENT LINE COUNTER 

350 IF LC<59 THEN 420:REM 58 MISMATCH LINES PER PAGE 

360 LC=0:REM RESET LINE COUNTER 

370 FOR 1=1 TO 6:REM SKIP LAST 6 LINES 

380 : PRINT#4 

39C NEXT 

400 PRINTIt4,NM$:REM TITLE NEXT PAGE 

410 REM END ON STATUS CHANGE, (END OF FILE) 

420 IF SI OR S2 THEN DCLOSE : PRINTM :CLOSE 4 : END 

430 AD=AD+1:REM ELSE INCREMENT ADDRESS COUNTER 

440 GOTO 150:REM & CONTINUE 

450 : 

460 REM DECIMAL TO HEX CONVERTER SUBROUTINE 

470 REM ENTER WITH NUMBER IN N 

480 REM RETURNS HEX EQUIVALENT IN HX$ 

490 IF N=0 THEN HX$= "00 " :G0TO 600:REM HANDLE EXCEPTION 

500 HX$="":REM INITIALIZE OUTPUT VARIABLE 

510 D=-LOG {N)/L0G(16) 

520 D%=D-(D<>INT (D) ) 

530 FOR I=D% TO : REM LOOP FOR DIGITS 

540 : P=16"(-I) 

550 : g%=N/P 

560 : HX$=HX$+CHR$ (Q%+48-7* (Q%>9) ) 

570 : N=N-Q%*P 

580 NEXT 

590 IF LEN(HX$)=1 THEN HX$= "0 "+HX$ : REM FORMAT 1 CHARACTER 

600 HX$="$"+HX$ 

610 RETURN 

620 REM SETUP SUBROUTINE 

630 PRINT"SOUP BY HENRY TROUP & JIM STRASMA 

640 PRINT"COMPAHES MACHINE-LANGUAGE PROGRAMS 

650 REM PRESET VARIABLES TO GAIN SPEED 

660 NL$="":ZE$=CHR$(0) 

670 INPUT"OUTPUT DEVICE: 3=SCREEN, 4=PRINTER 3===";0T$ 

680 DV=VAL(OT$) :REM CONVERT TO NUMBER 

590 IF DV<3 OR DV>4 GOTO 670:REM VALIDATE 

700 MF=2:REM 2 FIELDS PER LINE ON SCREEN 

710 IF DV03 THEN MF = 4:REM 4 FOR PRINTER 

720 CLOSE 4:0PEN 4,DV:REM HELLO DEVICE 

730 INPUT"FILE A'S NAME +===";CF$ 

740 INPUT"ON DRIVE 0===";R1 

750 IF RlOO AND RlOl THEN 740:REM VALIDATE 

760 DOPENitl, (CF$) ,D (Rl) :REM HELLO FILE A 

770 IF DS THEN PRINT DS$:GOTO 730:REM ON ERROR 

780 INPUT"FILE B'S NAME +===";PF$ 

790 INPUT"ON DRIVE 0===";R2 

800 IF R2<>a AND R201 THEN 790:REM VALIDATE 

810 D0PENlt2, (PF$) ,D (R2) :REM HELLO FILE B 

820 IF DS THEN PRINT DS$:GOTO 780:REM ON ERROR 

830 GETIH,Al$:GET(tl,A2$:REM READ A'S LOAD ADDRESS 

840 GETIt2,Bl$:GET»2,B2$:REM & B'S 

850 REM TRAP ZERO DATA BUG 

860 IF A1$=NL$ THEN A1$=ZE$ 

870 IF A2$=NL$ THEN A2$=ZE$ 

880 IF B1$=NL$ THEN B1$=ZE$ 

890 IF B2$=NL$ THEN B2$=ZE$ 

900 REM CALCULATE LOAD ADDRESSES 

910 AD=ASC(A1$)+ASC(A2$)*256 

920 A2=ASC (B1$)+ASC (B2$)*256 

930 IF AD=A2 THEN RETURN:REM IF MATCH, BEGIN 

940 PRINT"START ADDRESSES DON'T MATCH 

950 DCLOSE:REM ELSE CLOSE DISK FILES 

960 END:REM & ABORT 



SOUP Sample Run 



SOUP 

@$401, 

@$406, 

@$4flA, 

e$4aE, 

@$412, 

e$416, 

@$41B, 

@$41F, 



FILE A=SOUP 
A=$1B+B=$04 
A=$45+B=$20 
A=$44+B=S2C 
A=$43+B=$04 
A=$49+B=$4F 
A=$20+B=$4E 
A=$20+B=$44 
A=$50+B=$49 



& FILE B=SOUP 
@$402,A=$64+B 
@$407,A=$28+B 
@$4aB,A=S5a+B^ 
@$40F,A=$6E+B 
@$413,A=$52+B 
@$418,A=$44+B 
@$41C,A = $54+B^ 
e$420,A=$4C+B 



7SE82 

= $00 @$403,A= 
@$408,A= 
@S40C,A= 

e$4ia,A= 

@$414,A= 
@$419,A= 
@$41D,A= 
@$421,A= 



^$41 
^$2C 
^$00 
^$20 
^$45 
■$4C 
:$45 



$8F+B=$20 
$44+B=$2C 
$41+B=$32 
S8F+B=$20 
$4C+B=$49 
$44+B=$20 
$20+B=$43 
$52+B=$0O 



@$405,A=$20+B=$43 
@$4fl9,A=$4E+B=$2C 
eS40D,A=$29+B=$a0 
@$411,A=$50+B=$52 
e$415,A=$4E+B=$45 
@$41A,A=$42+B=$59 
e$4lE,A=$4f+B=$4D 
e$422,A=$76+B=$a4 

JMCRO 



It Pays to Write 
for MICRO 

Get paid for your ideas: write for 
MICRO! Tliousands of people 
read MICRO every month. MICRO 
Is sold in computer stores and on 
newsstands worldwide. Send for 
a copy of our Writer's Guide now. 
Our autlior payment rate is com- 
petitive with the leading maga- 
zines in the industry. 

We welcome articles on any 
aspect of 6502/6809/68000 hard- 
ware and software for the Apple, 
Atari, CBM/PET, TRS-80 Color 
Computer, VIC, OSI, 6809, or 
68000. 

1983 Features: March — Printers 
April — Communications 
May — Wave of New Computers 
June — Operating Systems 
July — Hardware 
August — Word Processing 
September — Education 
October — Programming 

Techniques 
November — Games 
December — New Microprocessors 



HiSflCkb|te-,J 



J«- 



-rl 



^£^«n IVIlCKObits' SOtJ: .uE^c^i^ 

-£y^eritt«i evpv F40-worJ.Tii»hE'.'.'' 
i^.€E:'3«i ' pw j' inii'rti nit ■ ■ fSiib-S'' 



f^M 









senti 










'■/^'^ 



-&,*> 



tf^iid tun way tu.I(.uni 'f^e^-\-^ 






!'"-*■ 'San AnKimo [ >. >?■}' ■ "^W 

P." • iCnntiriiril -in rJCT'S^' ' 



ijn? 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



53 



iMCQO 



PET Vet 



By Loren Wright 



Graphics on the Commodoie 64 

The Commodore 64 offers a lot of com- 
puting power in its small package. 
There are 64K of RAM, CP/M capa- 
bility, and sophisticated sound fea- 
tures. But the most outstanding feature 
is the graphics. To sum it up, the 64 
offers considerably more graphics capa- 
bilities than the Apple in this area and 
rivals the Atari 800, at a price that beats 
them both. 

What, exactly, does the 64 do in the 
way of graphics? I've been studying a 
preliminary draft of the Commodoie 64 
Piogiammei's Reference Guide and 
have begun to learn about all the 
graphics on my own 64. 

The 64 has the following modes, 
some of which can be mixed on the 
same screen: 

1. Standard character mode 

a. ROM characters 

b. Programmable RAM characters 

2. Multicolor character mode (both 
ROM and RAM) 

3. Extended background color mode 
(both ROM and RAM) 

4. Standard bit-map mode (320 x 200 
resolution) 

5. Multicolor bit-map mode (160 x 
200 resolution) 

6. Sprites (both standard and multi- 
color modes) 

Various blocks of memory and con- 
trol registers are involved in pulling off 
all these different modes. Screen mem- 
ory consists of 1000 bytes, normally 
located at $400, and these usually 
determine what characters will appear 
on the screen. There is a character 
ROM, which contains two complete 
character sets, as on the PET and VIC. 
Pointers may be altered so that custom 
characters can be set up in RAM. Color 
memory, which can't be moved, is 



1000 4-bit locations at $D800, each 
corresponding to a location in screen 
memory. Four bits is enough to code 
for sixteen different colors. 

The VIC II uses the different bits of 
two control registers to select nearly all 
of the graphics modes. Other registers 
are used to control positions and colors 
of sprites, to read light pens, and to 
select background colors. This month's 
data sheet [p. 109 | lists the control 
registers for the 64. I will refer to them 
here only by name. 

Chaiactei Modes 

The 64's characters are normally 
read from the character ROM and the 
color is determined by the contents of 
the corresponding location in color 
memory. The pointer to the character 
ROM can be altered to point to RAM, 
where you can design custom charac- 
ters. There's plenty of memory to play 
with, so this is a lot more practical than 
on an unexpanded VIC! 

Multicolor character mode has a lot 
of possibilities. Standard characters 
consist of eight rows of eight pixels, 
while multicolor characters consist of 
eight rows of four double-width pixels. 
(A pixel is the smallest dot of light on 



the TV screen in the current graphics 
mode.) The bits of each byte in charac- 
ter memory are considered in pairs 
rather than individually. Each of the 
four possible bit combinations for a bit 
pair determines where to get the color 
for the double-wide pixel on the screen. 
Combinations 00, 01, and 10 get the 
color from background registers 0, 1, 
and 2, respectively, and 1 1 gets the color 
from the appropriate location in color 
memory. Since any background color 
can be changed with a single POKE, 
parts of all the characters on the screen 
can be changed at once! This mode is 
probably best used with custom charac- 
ters, since this way of interpreting the 
character data would make most stan- 
dard characters nearly unrecognizable. 
The VIC uses a similar scheme in its 
multicolor mode. 

Extended background mode allows 
the background for each screen location 
to be any of four different colors. The 
sacrifice is that only the first 64 
characters in character memory can be 
used. Bits 6 and 7, which would nor- 
mally select the other 192 characters, 
determine the background color instead. 
The background color is read from 
background color register 0, 1, 2, or 3. 



Figure 1. Multicolor Character Mode a) Bits In character memory are considered in 
pairs, b) Each bit combination indicates a diferent source for the color, c) The final 
character displayed with double-width pixels. 



a) 1 1 



1 





1 


1 








1 


1 


1 


1 1 


1 1 


1 


1 


1 1 


1 1 


1 


1 


1 








1 


1 





1 





1 1 

Background 
Background 1 
Background 2 
4-bit color 





b) 00 


1 1 


01 


mtm 


10 


[iliiil 






11 


k \ 1 






location 






54 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



PET Vet 



(continued) 



Bit-mapped Modes 

Standard bit-map (or high- 
resolution) mode allows control of each 
individual pixel on the screen, with a 
resolution of 320 by 200. 8K of RAM, 
normally taken from the top of BASIC 
RAM, is used for high-resolution 
graphics. The bytes are arranged in the 
same way the pixels of characters are 
coded. That is, the first byte in hi-res 
memory codes for the first eight pixels 
in the first row of pixels on the screen, 
and the second codes for the first eight 
pixels in the second row. The ninth 
byte codes for the ninth through six- 
teenth pixels of the first row. What this 
means is that you have to go through a 
little arithmetic to find the correct bit 
to change in hi-res memory, given X (in 
the range of to 319) and Y (in the 
range of to 199). 

Screen memory is used to deter- 
mine the color of the pixels in the area 
normally occupied by a character. The 
high nibble determines the color of all 
the bits set to 1, and the low nibble 
determines the color for the O's. 

Multicolor bit-map mode reduces 
the resolution to 160 by 200. As with 
multicolor character mode, the bits in 
hi-res memory are considered in pairs 
to determine the color of the correspon- 
ding double-width pixel on the screen. 
Combination 00 selects the screen color 
(background 0), 01 gets the color from 
the high nibble of the appropriate byte 
in screen memory, 10 gets the color 
from the low nibble in screen memory, 
and 11 gets the color from the 4-bit 
color memory location. 

Commodore plans a VSP Cartridge, 
which will include convenient com- 
mands for high-resolution graphics. 

Fine Scrolling 

The VIC n chip allows the whole 
screen to be scrolled up, down, left, or 
right by only one pixel. To make this 
work smoothly, there are provisions to 
reduce the width of the screen to 38 
columns and to reduce the height to 24 
columns. That allows two columns 
(and/or one row] to be hidden, while 
characters are lined up before fine 
scrolling into the visible area of the 
screen. The programming for this 
smooth scrolling is best accomplished 
with some simple machine-language 
routines. 



Sprites 

What is a sprite? The name doesn't 
really mean much, but the concept is 
similar to "Player/Missile Graphics" 
on Atari computers. Each sprite is a 
high-resolution entity, 24 by 21 pixels, 
maintained by the VIC n chip. To pro- 
gram one all you need to do is define its 
bit pattern, select its color, select its 
X-Y position, and turn it on. By 
changing the X and Y values you can 
move the sprite to any position on (or 
off) the screen. 

Now, for the details... Eight sprites 
may be displayed on the screen at one 
time. Each sprite has a one-byte pointer 
at the top of the screen RAM block. The 
pointer indicates a 64-byte block 
within the 16K bank currently selected 
for the VIC II. The last byte of the 64 is 
a control byte; the others contain the 
pixel data for the screen representation 
of the sprite. Each three bytes represent 
a 24-pixel row in the sprite. In the stan- 
dard mode, a bit set to 1 displays a pixel 
of the selected color and a bit set to 
displays what's under it (usually the 
background, but it could be part of a 
sprite of lower priority!). 

Associated with each sprite are 
several other memory locations in the 
VIC II chip. The sprite display enable 
register has a bit for each sprite, as do 
the sprite multicolor enable, sprite ex- 
pand 2X horizonal, sprite expand 2X 
vertical, sprite-to-background priority, 
sprite-to-sprite collision detect, and 
sprite-to-background registers. Also, 
there is a byte for each sprite's vertical 
position, and a byte for each sprite's 
horizontal position. Since there are 
more than 256 possible horizontal posi- 
tions, there is also a byte containing a 
ninth X-position bit for each sprite. It 
sounds — and is — complicated. How- 
ever, this complexity is required to 
maintain such a powerful graphics 
mode. Read on for details of the dif- 
ferent capabilities of sprite graphics. 

Standard sprites can be displayed in 
any one of the sixteen colors in a 
resolution equivalent to the standard 
bit-map mode. Multicolor mode allows 
up to four colors in each sprite, and the 
colors are determined by considering 
bit pairs in the sprite definition. 00 
selects screen color, 01 the color in 
sprite multicolor register #0, 10 the col- 
or in the appropriate sprite's color 
register, and 11 the color in sprite 



multicolor register #1. As with the 
other multicolor modes, the horizontal 
resolution is decreased and the sprites 
are displayed using double-width pixels. 

Each sprite can be expanded to dou- 
ble its horizontal or vertical dimension 
or both. 

To handle smoothly the entry and 
exit of sprites on the screen, the possi- 
ble X and Y positions actually extend 
beyond the visible portion of the 
screen. That way it is possible to have a 
comer or an edge appear first, followed 
smoothly by the rest of the sprite. 

I mentioned priorities earlier. The 
sprites themselves have fixed priorities 
with respect to each other: sprite is 
higher priority than sprite 1, 1 higher 
than 2, and so on. However, each sprite 
may be selected to be higher or lower in 
priority with respect to the background 
data. Objects of higher priority will 
overwrite objects of lower priority. 

Collisions are detected by the VIC II 
and appropriate bits are set in two 
registers. If the corresponding sprite is 
involved in a collision, then its bit will 
be set in the register. The bits in the 
register will remain set until the 
register's contents are read by your pro- 
gram. Then the whole register is 
cleared. There is one register for sprite- 
to-sprite collisions and another for 
sprite-to-background collisions. 

Some of the limitations can be cir- 
cumvented with more sophisticated 
programming. For instance, it is possi- 
ble to display more than eight sprites at 
once using raster interrupt techniques. 
Also, because there is so m^uch mem- 
ory, you can have lots of sprite defini- 
tions stored and only alter the pointers. 
If the fixed sprite priorities are a prob- 
lem, just swap the pointers and the ap- 
propriate bits and registers. 

The Piogiammei's Reference 
Manual gives all the details of the 
various graphic modes, along with sam- 
ple programs. Even the little quirks of 
the system (and ways to get around 
them) are mentioned. It is good to see 
Commodore finally paying attention to 
quality documentation with the 
VIC-20 and Commodore 64 Piogiam- 
mei's Refeience Guides. The Guide for 
the 64 should be available in early 
December. 

iMCRO 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



55 



- - 


Miam :^'::'™i«iiin 


^, — 




f ' 






a AM-no 

(^ ' 


\ 




a 





A 

ATARI 




II 

m 



400 

16K *269 

32K *349 

48K M29 

410 Recorder $ 76.00 

810 Disk Drive $449.00 

822 Printer S269.00 

825 Printer $589.00 

830 Modem $1 59.00 

820 Printer $259.00 

850 Interface $1 69.00 

CX40 Joysticks (Pair) $ 1 8.00 

CX853 Atari 1 6K Ram $ 77.95 

ATARI 

Pac Man $35.00 

Centipede $35.00 

Caverns of Mars $32.00 

Asteroids $29.00 

Missile Command $29.00 

Star Raiders $35.00 

DATASOFT 

Pacific Coast Highv^ay $25.00 

Canyon Climber $25.00 

Tumble Bugs $25.00 

Shooting Arcade $25.00 

Clowns and Balloons $25.00 

Graphic Master $30.00 

Graphic Generator $13.00 

Micro Painter $25.00 

Text Wizard $89.00 

Spell Wizard $64.00 

Bishop's Square $25.00 

ON-LINE 

Jawbreaker $27.00 

Softporn $27.00 

Wizard and the Princess $29.00 

The Next Step $34.00 

Mission Asteroid $22.00 

Mouskattack $31.00 

SYNAPSE 

File Manager 800 $79.00 

Chicken $26.00 

Dodge Racer $26.00 

Synassembler $30 00 

Page 6 .. $1900 

Shamus $26.00 

Protector $26.00 

Nautilus $26.00 

Slime $26.00 

Disk Manager $24.00 

K-BYTE 

Krazy Shoot Out $32.00 

K-razy Kritters $32.00 

K-razy Antics $32.00 

K-3tar Patrol $32.00 

STICK STAND % 

$Q99 





800 — 48K 

Microtek IBKRam $ 74.95 

Axlon Ramdisk (1 28K) $429.95 

Intec 48K Board $1 59.00 

Intek 32K Board $ 74.00 

One Year Extended Warranty $ 70.00 

CX481 Entertainer Package $ 69.00 

CX482 Educator Package $130.00 

CX 483 Programmer Package $54.00 

CX 484 Communicator Package $344.00 

Atari 800 Dust Cover $6.99 

Atari 400 Dust Cover $6.99 

Atari 810 Dust Cover $6.99 

VISICORP 

For Apple, IBM, Franklin 

Visidex $189.00 

Visifile $189.00 

Visiplot $1 59.00 

Visiterm $1 89.00 

Visitrend/Plot $229.00 

VisiSchedule $229.00 

Desktop Plan $189.00 

VISICALC $1 79.00 

for Apple II plus. Atari. CBM & IBM 

Continental 

The Home Accountant (Apple/Franklin) $59.00 

The Home Accountant (IBM) $11 9.00 

1 St Class Mail $59.00 



FLOPPY 
DISKS 

MaxeU 

MD I (Box of 10) $36 00 

MD II (Box of 1 0) $46.00 

MFDI(8'T $44 00 

MFD II (8" Double Density) $54 00 

Verbatum 

51/4"SSDD $2600 

5 1/4"DSDD $36 00 

Elephant 

5 1/4"SSDD $19.99 



TIMEX 

TIMEX SINCLAIR lOOO 



LOWEST 

PRICE 

EVER! 



$89*00 



NORTH STAR 

ALTOS 

Call for price and availability 
on all models. 




Disli Drives For 
Atari Computers 

81 Singli- Drive $589.00 

Al Add-on Drive $339.00 

S2 Dual Drive $879.00 

Single Side Dual Head . . $679.00 
Dual Drive Dual Head. . $1046.00 



/i-SCI 




MICRO-SCI 

Oisl( Drives For 
Franldin & Apple 

A2 $319.00 

A40 $369.00 

A70 $499.00 

C2 Controller $79.00 

C47 Controller $89.00 



MODEMS 

Hayes 

Smart $239.00 

Smart 1200 (1200 baud) $549 00 

Chronograph... $199.00 

Microdismll $279.00 

Microdem 100 $309.00 

Novation 

Cat $144.00 

D-Cal $159 00 

Auto Cat $21900 

212AuloCat $589.00 

Apple Cat II $339.00 

212 AppleCat II $60900 

Anchor 

Mark I (RS-232) $79.00 

Mark II (Atari) $7900 

Mart( III (TI-99) $109.00 

Mark IV (CBM/ PET) $125 00 

Mark V (OSBORNE) $96.00 

Mark VI (IBM-PC) $179.00 

Mark VII (Auto Answer/Dial) $ 1 1 9.00 

9 Volt Power Supply $9 00 



v\/est; 



800- 648-33 1 1 



v\/est; 



IN NV. CALL (70e] 088-0804 
P.O.BOX 8889 STATELINE, NV. 8S4<49 

In-stock items shipped same day you call. No risk, no deposit on CO.O. orders. Pre- paid orders receive free shipping within the continental United States with no waiting period 
torcertified checks or money orders. Add 3'Ki(minimum $3.00) shipping and handling on all C.O.D. and Credit Card orders. NV and PA residents add sales tax. A/I items subject 
to availability and price change. NOTSi We stock manufacturer's and third party software for most ail computers on the market! Call today for our new catalogue. 



MONITORS 

AMDEK 

300G $ 1 69.00 

Color I $339.00 

Color II $699.00 

Color III $429.00 

BMC 

12" Green $85.00 

13„ Color 1400 $279.00 

13" Color 1401 (Mid Res) $369.00 

ZENITH 

ZVM 121 $99.00 

SHARP 

Sharp 13" Color TV $275.00 

PANASONIC 

TR-1 20 MIP (High Res. Green) $ 1 59.00 

CT-1 60 Dual Mode Color $299.00 



■ 



P FRANKLIN 

W 




64K Personal Computer 

Hardware, Software and 
peripheral compatable with the 
Apple II and even has some 
features not found on the Apple. 



HEWLETT PACKARD 



m 

HP«85 
M969 




HP-125 $1969.00 

HP-85 16K Memory Module $169.00 

5 1/4" Dual Master Disk Drive $1799.00 

Hard Disk w/ Floppy $4349.00 

Hard Disk $3549.00 

"Sweet Lips" Plotter $11 99.00 

80 Column Printer $649.00 



WApt HEWLETT 
mi'/^ PACKARD 

HP 41 CV 
CALCULATOR 



*209 



HP 41 C .~. .T: $1 49.00 

HP IOC $69.00 

HP nC $79.00 

HP 12C $114.00 

NEW 1 1 5C $1 09.00 

NEW 1 60 $ 1 1 4.00 

HPIL PERIPHERALS IN STOCK! 




PC-1500 

POCKET COMPUTER 



ALSO AVAILABLE: 

Printer w/cassette Interface 

cassette tape recorder 

and 4K and 8K RAM EXTENSIONS 



COniPUTER 




64K RAM 

780 KB Disk Storage 

Word Processing, Ultracalc CP/M, 

C Basic Software 
Smith Corona TP1 

Letter Quality Printer Qur Pfice 

Retail Value $4895.00 $X99S«00 







PC 




Call... 

for price and availability 
on IBM-PC hardware, soft 
ware and peripherals. 

NEC 3550 Printer (for IBM) $2099.00 



Televifleo 
Terminals 

910 $579.00 

91 2C $699.00 

920C $749.00 

925C $749.00 

950 $950.00 



800A $1319.00 

802 $2649.00 

802H $4695.00 

806 $5795.00 

816 $9495.00 




SEC 

COMPUTERS 

800 1 -A ^""'^".'. ""° $749.00 

8031 $749.00 

8012 $549.00 

Printers 

8023 $549.00 

7710/7730 $2399.00 

351 0/3530 $1 599.00 

„ „ Monitors 

JB-1 201 $1 59.00 

JC-1 201 $329.00 

JC-1 202 $899.00 



commodore 

8032 $999.00 

CBM 64 CALL 

4032 $749 00 

8096 Upgrade Kit $369.00 

Super Pet $ 1 599-00 

2031 $369,00 

8250 Double Sided Disk Dnve $i 699.00 

D9060 5 Megabyte Hard Disk $2399.00 

D9090 7.5 Megabyte Hard Disk $2699.00 

8050 $1299.00 

4040 $969.00 

8300 (Letter Quality) $1549.00 

8023 $599.00 

4022 $399 00 

New Z-Ram. Adds CP/M and 64K Ram $549.00 

Ttie Manager . $209.00 

Magis CALL 

Word Pro 5 plus $319.00 

Word Pro 4 plus $299 00 

Word Pro 3 plus $199.00 

The Administator $379.00 

InfoPro Plus $219,00 

Power $79.00 

VIC 20 Dust Cover S6.99 

CBM 8032 Dust Cover $14.99 

CBM 8050/4040 Dust Cover $10.99 



»179 

VIC 1 530 Commodore Datassette $69.00 

BIC 1 540 Disk Drive $339.00 

VIC 1541 (64 Disk Drivel CALL 

VIC 1525 Graphic Printer $339.00 

VIC 1210 3K Memory Expander $32.00 

VIC 11 to 8K Memory Expander $53.00 

16K VIC Expansion $94.00 

VIC 101 1 RS232C Terminal Interface $43.00 

VIC 11 1 2 VIC IEEE-488 Interface S86.00 

VIC 1 2 1 1 VIC 20 Super Expander $5300 

VIC Mother Board $99.00 




PRINTERS 

Smith-Corona 
TP-1 



'599 




CITOH (TEC) 

Starwriter(F10-40CPS) $1399.00 

Printmaster(F10-55CPS) $1749.00 

Prowriter 80 Col (P) $499.00 

Prowriter 80 Col (S) $629.00 

Prowriter 2 (132 Col) $799.00 

Okidata 

82A $429 00 

83A $659 00 

84P $107900 

84S $119900 

IDS 

1 32 (fully configured) $1 599.00 

80 (fully configured) $ 1 399.00 

Call for other configurations. 

Daisywriter 

Letter Quality $ 1 049.00 



east 



800-233-8950 



IN PA. CALL [717] 3e7-9S7S 

477 E. THIRD ST., WILLIAMBPORT, PA. 17701 

In-stock items shipped same day you call. No risk, no deposit on COD. orders. Pre-paid orders receive free shipping within the continental United States with no waiting period 
forcertified checks or money orders. Add 3% (minimum $3.00) shipping and handling on all COD. and Credit Card orders. NV and PA residents add sales tax. All items subiect 
to availability and price change. NOTKi We stock manufacturer's and third party software for most all computers on the market! Call today for our new catalogue. 



I 




This is just 1 of 20 
pages of the newest 
and biggest Skyles 
catalog, hot off the 
press. 

We know you'll want 
this page, in its full 
872 X 10 splendor, 
and another 19 
pages of peripherals, 
software and books 
that will make your 
PET or CBM 
computer even nicer 
to live with. So, if 
we missed sending 



\ 










you your very own 
copy within the last 
few weeks, call us at 
(800) 227-9998 
(unless you live 
in California, in 
which case call 
(415) 9651735. 



From Skyles 

FIf ctric Works, the 

oldest and largest 

professional 

specialists in the 

business. 



(h Skyles Electric Works 

B^ 231-E S. Whisman Road 
^^ Mountain View, California 94041 



commodorel 



Microcomputers in a College 
Teaching Laboratory, Part 2 



by Richard Heist, Tlior Oisen, and Howard Saltsburg 



Many laboratory situations 
involve measuring continuous 
ranges of light, heat, and sound. 
An inexpensive device to help 
the digital computer deal with 
these analog quantities is the 
analog transducer. Specific 
applications to temperature and 
light intensity measurement 
are discussed. 

Part 1 of this series (MICRO 53:53|i 
gave an overview of the microeomputer 
laboratory program at the University of 
Rochester, Department of Chemical 
Engineering. In this article the prob- 
lems of measuring physical, chemical, 
and mechanical properties will be ad- 
dressed, since such problems are com- 
mon to most engineering and scientific 
laboratories. Temperature, pressure, 
flow, and light intensity are typical 
quantities of interest, and in many 
cases the required information is pro- 
vided by a transducer in the form of an 
analog signal, usually electrical in 
nature. Difficulties in the measure- 
ment and conversion to the desired 
physical or chemical quantity of these 
signals may tend to obscure the pur- 
pose of the measurement. The micro- 
computer often offers a simpler alter- 
native to more conventional laboratory 
instrumentation, thus making it easier 
for the user to maintain a focus on the 
purpose of the measurements. Further- 
more, it combines this decrease in 
complexity with low cost, high speed, 
reliability, and precision. 

In what follows, the use of simple 
interfacing devices will be discussed. 
These devices were selected for their 
flexible operating characteristics, 
which give them quite general utility. 
Examples will illustrate their applica- 
tion to the measurement of tempera- 
ture and light intensity. The emphasis 
will be on specific applications, not on 



design or construction of the devices, 
which are very simple. 

Analog Signals and 
A/D Converters 

When the transducer of interest pro- 
duces an electrical signal, the problem 
of property measurement is reduced to 
one of measuring that signal (usually 
voltage, current, or resistance) to the 
desired degree of accuracy and at an ap- 
propriate rate. Many laboratory meas- 
urements require only slow ( < 50 Hz) 
data acquisition rates or low [8-bit) 
precision. The actual requirements 
should be evaluated carefully and 
realistically since they have an impor- 
tant bearing on the technique and in- 
strumentation used to measure the 
electrical quantities. 

When high-speed data acquisition 
and high resolution are not needed, it is 
remarkably easy to interface many 
laboratory experiments and measuring 
devices to the computer. As will be 
demonstrated, an appropriate A/D con- 
verter, selected for its flexibility, com- 
bined with a microcomputer and a 
high-resolution dot matrix printer, 
becomes a versatile data acquisition 
system (the universal instrument refer- 
red to in the first article in this series 
(MICRO 53:53). This combination can 
be used effectively and inexpensively 
to solve many laboratory measurement 
problems. 

The two types of A/D converters, 
which have been widely used in the 
Rochester program, both employ a 
pulse-width technique for data conver- 
sion, even though one is used to 
measure voltage and the other resis- 
tance. Each device, upon command 
from the computer (a trigger pulse) 
begins a timing cycle, the length of 
which is proportional to the magnitude 
of the applied analog signal. At the end 
of the cycle, the converter signals the 



computer that conversion is complete 
(end of conversion, EOC). 

The computer is programmed to 
measure the length of the timing cycle 
by repeatedly incrementing the micro- 
processor index registers until the EOC 
signal is received. The microprocessor 
requires a fixed number of machine 
cycles to run thiough the program loop 
in which it tests for EOC and incre- 
ments the index registers. Since these 
cycles are accurately timed by the in- 
ternal crystal oscillator, the count ac- 
cumulated in the index registers is pro- 
portional to the elapsed time. By 
suitable calibration, this count can be 
converted to the desired data format, 
and the measurement is complete. 

Typical resolution can range from 
eight to 12 bits; the corresponding con- 
version times are approximately three 
to 200 milliseconds. The ability to 
trade off conversion time for resolution 
gives these simple devices a flexibility 
not shared by other kinds of A/D con- 
verters and makes them feasible for 
many laboratory applications. 

The device used for voltage meas- 
urements is a Q'M-lOO A/D converter 
(Analog Systems, P.O. Box 35879, Tuc- 
son AZ) . This device has three indepen- 
dent A/D channels, each with a to 10 
VDC input range. In operation, a 
voltage ramp generator is triggered by 
the computer, and its output is com- 
pared to the transducer voltage. A com- 
parator signals the computer when the 
ramp just exceeds the transducer 
voltage (EOC). 

For resistance measurements, a 
simple A/D method outlined in an arti- 
cle in MICRO^ was chosen. It uses a 
555 timer IC in the configuration 
shown in figure 1. The conversion 
method involves charging the timing 
capacitor, CI, to a fixed voltage 
through the transducer resistance, R, 
and measuring the charging time with 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



59 




commodore 



5VDC 



TRIGGER 

OUTPUT 
(EOC) 



;v,, 



:;»ife:::7 






■v*V 



555 



-th 



C2 



Ij-y- 






m 



Hv^S^ 









T CI 




.^.:^ 



Figure 1: A 555 timer integrated circuit wired as a monostable multivibrator. A typical 
value for C2 is .01 ^F. Ttie value chosen for C1 depends upon R. For Instance, If R = 
150 KQ and 10-bit conversion is desired (1024 counts, see text), tlien C1 siiould be 
about 0.1 ^F (see reference 3). 



the computer. The computer triggers 
the charging process and is then sig- 
naled by the 555 timer when conver- 
sion is complete. By choosing the ap- 
propriate combination of transducer 
and timing capacitor for a specific ap- 
plication^, you have a simple and inex- 
pensive data acquisition system. 

While the examples described here 
are specific to temperature and light- 
intensity measurements, the concepts 
are general. These interfacing methods 
can be extended to virtually any kind of 
voltage or resistance measurement. 
Moreover, it is clear that the use of a 
resistance transducer, when appropri- 
ate, can result in a significant simplifi- 
cation of hardware, compared to other 
techniques, and it will often pay to 
change to sensors of this type. 

One additional point that should be 
made in connection with the pulse- 
width A/D converters is the ease with 
which these devices can be multi- 
plexed. Many times it is necessary to 
measure a number of inputs simultane- 
ously. Since most microcomputers will 
support only a limited number of I/O 
lines, it is useful to be able to switch- 
select devices automatically (multi- 
plex). Examples of this include the 
simultaneous monitoring of the tem- 
perature of each tray of a multistage 
distillation column and multiple con- 
centration profile measurements along 
a tubular reactor. The circuit shown in 
figure 2 has been used to multiplex the 
sensors in several experiments. It is 
based on the 74150 IC, a 16-channel 



multiplexer. A similar circuit, based on 
the 75151 IC, can be used to construct 
an 8-channel device. Both multiplexer 
ICs and their operation are described in 
detail in the literature listed in 
reference 4. 



TBIOGFH-«i^^'»'gfc1i^' '^-'-. 



Construction details have not been 
discussed at length since they are ade- 
quately described in the microcom- 
puter and electronics literature^, but 
good construction techniques must not 
be underemphasized, particularly for 
applications requiring higher precision. 
The important construction practices 
are documented in the literature and 
are well known to experienced person- 
nel. Do not hesitate to ask for advice. 

Some care should be exercised in 
the use of the converters. For instance, 
the characteristics of all electronic 
components are, to some extent, tem- 
perature-dependent. Therefore, large 
fluctuations in ambient temperature 
should be avoided during data collec- 
tion or between calibration and actual 
use. Another point concerns the use of 
the 555-based converter in the triggered 
mode described above. When the EOC 
is reached, the 555 IC starts discharging 
the timing capacitor and the system 
will remain in discharge mode until it 
is triggered again. If the time between 
EOC and the next trigger pulse varies, 
the circuit may operate with varying 
levels of residual charge on the timing 
capacitor. The result will be timing er- 



f 




T 



Ih 



w 



li 



x 



tF^ ,1- -is* 



!> 555 



I 555 



11 

. nz 



R1 



I--- 



•%• 



21 



THL NETWORK OF FOUR 555 
TIMERS SHOWN ABOVE fS - 
REPEATED THREE TIMES ". 
GIVING 16 SEPARATE UNITS , 






Pigute 2: A 16^hannel multiplexer circuit based on a 74150 TTL Integrated circuit. 
Tfie end-of-conversion signal, pin 3, of any of the 555 timers can be accessed by 
placing the appropriate binary number (0-15) on the Input pins (15, 14, 13, and 11, 
respectively) of the 74150. In the diagram, PAO - PA4 and PA7 represent PET parallel 
port connections. The output from the 74150 is available at pin 10. The resistance 
value of the transducers, RO - R15, will determine the value of the charging capacitor, 
C (see figure 1). A typical value is 0.22 ^^F (see reference 3). 



60 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



commodore 



31.6K'.i 







D1 = Germanium diode 

D2 =' P.U.T., GE D13T1 or equivalent 

D3 = LED 

Figure 3: A two-stage voltage amplifier. The overall gain ranges from 630 to 1260, depending upon the setting of the 20 Ks 
variable resistor in the feedback loop of the second stage. The optional diode network ensures that the output voltage will be 
positive (D1) and will not exceed 10VDC (D2). This is a requirement for proper operation of the QIM-100 A/D converter. D3 is 
used to indicate over-ranging. 



rors, leading to poor reproduction of the 
data. The problem can be circumvented 
by introducing a sufficient delay be- 
tween measurements to assure total 
discharge, or by operating the system 
with reproducible discharge time. 
Temperature Measurement 

Two analog electrical signals com- 
monly associated with temperature are 
thermocouple voltage and thermistor 
resistance. The problem is to provide a 
convenient method for measuring 
these analog signals, then convert the 
results to temperature. 

Consider, for example, a tempera- 
ture measurement in which a precision 
of one degree Celsius is desired at a 
temperature of 100 degrees. If the sen- 
sor is a thermocouple, the transducer 
output will be in the low millivolt 
range and a difference of one degree in 
temperature would produce a voltage 
difference of, at most, a few tens of 
microvolts — beyond the direct resolu- 
tion of most analog meters. As the 
precision requirement of an experiment 
increases, conventional thermocouple 
instrumentation becomes costly. 

With digital instrumentation, this 
precision is not difficult to achieve. 
Provided the input signal at 100 degrees 
is within the upper half of the con- 
verter's input range, all that is required 
is an eight-bit A/D converter. An ob- 
vious problem, then, in interfacing 
thermocouples (and many other labora- 
tory devices as well) is the low level of 



the output voltages. The millivolt-level 
signals generally available must be 
amplified to the 0.5 to 10 VDC range 
before A/D conversion can be performed 
satisfactorily. Fortunately, the fre- 
quency response requirements are min- 
imal for most applications, so large- 
gain amplifiers (lOOX - 2000X) are 
relatively simple to build*. See figure 3 
for a typical example. When adjustable 
gain is included, the combination 
amplifier and QM-100 converter be- 
comes an A/D system that is inexpen- 
sive, versatile, and reliable. 

Thermistors, in contrast to thermo- 
couples, can be manufactured to pro- 
vide large resistance changes for small 
temperature differences. Unfortunately, 
the response is highly non-linear, and 
the response characteristics tend to be 
non-uniform, even among thermistors 
of the same kind. These properties 
make it difficult and expensive to 
reduce thermistor output to tempera- 
ture with analog hardware. Using a 
microcomputer with the 555 timer 
A/D, on the other hand, you can easily 
handle these complex relationships with 
appropriate software modifications. 

Light-Intensity Measurement 

Another property commonly meas- 
ured in laboratories is light intensity. 
In chemical laboratories, this measure- 
ment is usually made with commer- 
cially available instrumentation equip- 
ped with photocells or photomultiplier 



tubes (e.g., colorimeters and spectro- 
photometers). It has proven to be easy 
to use either the QM-100 or the 555 
converter to interface the micro- 
computer to such optical instruments. 
In fact, inexpensive colorimeters based 
on a 555 timer/photoresistor circuit 
can be built to almost any geometry re- 
quired by an intended application. 

For photomultiplier-equipped spec- 
trophotometers where the output sig- 
nal is a ctirrent, a simple circuit can be 
used to convert the transducer output 
to a voltage*. A typical example of a 
current-to-voltage converter circuit is 
shown in figure 4. Once a voltage is 
available, the procedure for using the 
QM-100 is the same as described above. 

A major use of this type of optical 
instrumentation is in measuring the 
concentration of light-absorbing 
chemicals in liquids and gases. Nor- 
mally, the response of such instru- 
ments is proportional to the inverse ex- 
ponential function of the concentra- 
tion. Thus, should a linear response be 
required when using a chart recorder 
for data acquisition, an expensive 
linearizing module must be added. 

In some cases, not only is a linear 
response required, but the quantity of 
interest is the total amount of a 
chemical that has passed through the 
detector. This type of measurement re- 
quires the capability to integrate a 
response over time — another module 
to add to the recorder. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



61 



commodore 



'in o- 



200 J 1 



o I > 



160JI 




o ^Qut 



Figure 4: A current to voltage converter. The circuit shown here will typically produce 
millivolt-level output for microampere-level input with good frequency response. 



When the microcomputer is used to 
monitor such instruments, these con- 
versions require only a few lines of ad- 
ditional code in the applications pro- 
gram. Within the limits of the micro- 
computer's capabilities, any relation- 
ship between sensor output and the 
quantity of interest can be accommo- 



dated without additional cost as long as 
the relationship can be adequately des- 
cribed by mathematical expressions. 
Also, since the computer can store 
spectral data between scans, it is possi- 
ble through computer interfacing to 
convert a single-beam spectrophoto- 
meter into a pseudo dual-beam device. 



The simplicity of microcomputer- 
based systems can best be illustrated by 
the measurement of optical density of 
fluids. A-Q extremely simple colori- 
meter, useful for many chemical con- 
centration measurements, can be con- 
structed from a suitable light source, 
such as a light-emitting diode, and a 
photoresistor, placed on opposite sides 
of a translucent vessel containing the 
fluid to be studied. The photoresistor is 
interfaced via the 555 A/D converter. 
Since the components (light source and 
photoresistor) can be very small, e.g. 
three mm diameter, and the units are 
so simple, a variety of geometries can 
be accommodated. Thus, a chemical 
reaction involving a color change can 
be followed in situ in a small test tube. 
There is no need to disturb the process 
by withdrawing samples for analysis. 

Another example is the study of the 
dispersion of a dye in a liquid flowing 
in a long tube. It is a simple matter to 
place these LED-photoresistor color- 
imeters in collars clamped around the 
tube, at intervals, and observe the 
dispersion effect without disturbing the 
flow. 

Note that when a LED is used in 




PREMIER 
ISSUE 




ommanoer 



THE MONTHLY JOURNAL FOR 
COMMODORE 

COMPUTER USERS 

.ao 64 P£r/cs 

MAX MACHINE 

'COMMANDEH u/i/( b« d«dicaf*d fo commun»cating rh* f\tn of, as ujtil as fA# 
latest jn/ormo/ion a6ou( fh* COMMODORE COMPUTERS.' 

GET YOUR MONEY'S WORTH 

You ve probably made a 3i2eabl« inv«5im«ni in your cotnpuMr 
equipment. COMMANDER can help you make the most o( ii. Each 
is3u< bnngs you the no-nonsense advice you need to stay on the 
leading edge o( this conjiantly changing field. COMMANDER will be 
your reference source to the world o/ computers with the best . most 
comprehensive coverage you can get)! 



PREMIER ISSUE 
U DISCOUNT 



a I YD. J23 a J YR. $40 a a vn. «* 

iPmCES DO NOT irKLUOe M DISCOUNT) 

COMMANDER 

5./*«:r.pJKVi Or</«rl On/y P O BOX 98827 

To» FfM Numb»r 1-400-426- lUO TACOMA. WASHINGTON 98499 

Kunx WA Ml aXi (204) SAS-M18 



SOPHISTICATED TELE-COMMUNICATION IS HERE 

THE COMMUNICATOR 

for 4.0 Commodore Computers 

With: HIGHER SPEED 

MORE SOPHISTICATED CONTROL 
LOWER PRICE 

THE HARDWARE — A printed circuit board; easily installed in the 
CBM. It uses no CBM connectors; gives a serial port with true 
RS232C standard. The board alone is capable of running up to 9600 
baud. With the software it will run up to 4800 baud. 

THE SOFTWARE - 

— Emulates the ADDS Regent 100, ADM 31 and/or the TeleVideo 
950.' Or choose the VT100 model for use with DEC and VAX 
computers. 

— Runs coresident with BASIC programs; lets BASIC programs 
and program on host computer communicate to develop really 
sophisticated communication and control capabilities. 

— The program is on ROM at either address; no disk loading re- 
quired. Uses only 512 bytes of RAM; will relocate itself around 
any other machine language program at top of memory. 

— Will upload and download and run BASIC programs. With BASIC 
program will upload and download standard data files. 100 page 
manual gives program li-sting for BASIC programs. 

Excellent text editor designed to work with THE COMMUNICATOR 

THE COMMUNICATOR $200 THE COMMUNICATOR antl 

Text Editor $ 40 U.D.S. 1200 baud modem $625 

U.D.S. 1200 baud $450 THE COMMUNICATOR and Haves 

Hayes 300/1200 baud $595 300/1200 baud modem S770 

We sell U.D.S. and Hayes 300 baud modems at excellent prices 

AMPLIFY, INC. 

2325 Macbfide, Iowa City, Iowa 52240 319-337-8378 

'trademarks Adds Regent, Inc., Lear Siegler, Inc.. Tetevideo Systems. Inc. 



62 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



commodore 



this mode it is important that it is sup- 
plied a constant current. A simple cir- 
cuit that will accomplish this' is 
shown in figure 5. 

Concluding Comments 

The general utility of the A/D con- 
verter (computer) printer combination 
deserves reiteration. In going from one 
application to another, only portions of 
the applications program need to be 
changed; the data acquisition routines 
remain unaltered. The A/D devices 
previously described can be adapted to 
a variety of resistance, voltage, and cur- 
rent measurements with little or no 
modification. The flexibility of these 
A/D converters, the computational 
capability of the microcomputer in the 
reduction of data, and the high- 
resolution hard copy capability of the 
dot-matrix printer are combined to 
make the system an inexpensive but 
powerful universal data acquisition 
instrument. 

Once it is realized that resistance 
and voltage can be measured so easily 
with the microcomputer, you may 
wish to redesign existing experiments 
to match the output to the interface, 
rather than the other way around. In 
particular, it may be advantageous to 
generate resistance, rather than current 
or low-level voltage; e.g., use thermis- 
tors instead of thermocouples. 

At moderate expense, the system 
can be expanded further to provide the 
capability to feed back information and 
change the operating conditions of the 
device it monitors. Digital to analog 
conversion and control will be dis- 
cussed in a subsequent paper. 

The role of the computer in the 
laboratoy is that of a tool. Certainly it 
is a remarkable tool in terms of power 
and capability; but nevertheless, it is a 
means to an end and not the end in it- 
self. This point is sometimes too easily 
forgotten. 

References 

1. H. Saltsburg, R.H. Heist, and T. 
Olsen, MICRO, The 6502/6809 
foumal, (53:53). 

2. J. Sherburne, MICRO, The 6502/ 
6809fouinal, (26:31). 

3. See, for example, H. Berlin, "The 
555 Timer Applications Sourcebook 
with Experiments," (Howard W. 
Sams and Co. Inc., Indianapolis, 
1979). 

4. See, for example, "Signetics Logic — 
TTL Data Manual," (Uniplan, San 



V„ (+5 to,«(y) 




two LEOs in seciss. one 
Uu sample circuit and 
one idr reference circuil 



... = 5V and 2 LEOs 
in series. R = 5-i01i 



Figure 5: A current regulator. The LM334 is 
an adjustable current source with good 
current regulation. A typical value for R 
with two LEDs In series is 5 to 10 ohms. 
The two LEDs In series are used to provide 
a sample signal and a reference signal for 
the colorimeter applications discussed In 
the text. 

Francisco, 1978); "The TTL Data 
Book," (Texas Instrument, Inc., 
1976), 2nd ed.; D. Lancaster, "The 
TTL Cookbook," (Howard W. Sams 
and Co. Inc., Indianapolis, 1979). 

5. See, for example, P. Horowitz and 
W. Hill, "The Art of Electronics," 
[Cambridge University Press, Cam- 
bridge, 1980); P.M. Mims, "Engi- 
neer's Notebook II. Integrated Cir- 
cuit Applications," (Tandy Corpora- 
tion, 1981); Z.H. Meiksin and P.C. 
Thackary, "Electronic Design with 
Off-the-shelf Integrated Circuits," 
(Parker Publishing Co. Inc., West 
Nyack, NY, 1980); S.A. Hoenig, 
"How to Build and Use Electronic 
Devices without Frustration, Panic, 
Mountains of Money or an Engineer- 
ing Degree," (Little, Brown and Co., 
Boston, 1980) 2nd ed. 

6. See, for example, W. Jung, "IC Op- 
amp Cookbook," (Howard W. Sams 
and Co. Inc., Indianapolis, 1979); 
"Operational Amplifiers: Design 
and Application," (McGraw-Hill 
Book Company, New York, 1971), 
edited by J.G. Graeme, G.E., Tobey, 
and L.P. Huelsman. 

7 P.M. Mims, "Engineer's Notebook 
11. Integrated Circuit Applications," 
(Tandy Corporation, 1982) p. 116. 

You may contact the authors at the 
Department of Chemical Engineering, 
University of Rochester, Rochester, NY 
14627. 



PROFESSIONAL 

WORD PROCESSOR 



FOR APPLE/PET/CBM 

COPY-WRITER 

only S185.00 



EXCHANGE DATA w IBM 3740 

PEDISK II 877 FLOPPY DISK Sys- 
-:' terns c<tn now read and write records 

i-l tfom IBM "Basic Data Exchange" 

*^.' "■ type (ilskettes. FILEX software from 
WILSEBVE does all the work! Con- 
verts EBCDIC - ASCII. 

EXCH AieBjj tein 1877/FILEX) $1 295. 

PEDISK 877-1 8' Floppy tor PET S 995. 

PEDISK 540-1 5' Floppy lor PET S 595. 

CONTROLLER BOARD w PDOS S 229. 

PEDISK II is a high pertormance floppy disk 
system designed tor the Commodore PET/CBM, 
Rockwell AIM and Synertek SYM. It features high 
pertormance, simple reliable design and IBM for- 
mat. 

SOFTWARE FOR PEDISK II 

COPYWRITER Pro Word Processor $185. 

MAE Macro Assembler Editor by EHS $1 70. 

FLEXFILE II Data Base Manager $ 80. 

PAPERMATE Word Processor $ 60. 

DISK UTILrTYPACK $ 25. 

FASTFILE Data Base $1 00. 

RLEX IBM Access Routines $245. 

MENU LOAD $ 10. 

lullFORTH-f $1 00. 



Commodore Communicates 

COMPACK $129. 

Intelligent Teminal Package 
including ACIA based interfaci 



etry . XON XOFF Control 

Disk ^ User Program Cntl 



$139 COLOR CHART 

AIM/SYM system video display, 64 x 1 6 

characters, 8 colors, plugs into ROM 

socket, 4K RAM Multiple modes; semi 

graphics, alpha. 

PET/CBM color graphic display, 1 28 x 

1 92 pixels, generate color bar graphs 

on one screen with data on main 

screen. RS170 video color chart. 

6847 based video output. 

COLOR VIDEO FOR PET/C8M/AIM/SYM 



ROMSWITCH-4 ROMS IN 1 

SPACEMAKER $39.95 

Switcti 4 ROMs into ttie same socket 
A slide switcti activates one of four 
Electronic controls insure no glitcfies 
and allow ROM switching under soft- 
ware control ROMs can be switched 
from the keyboard 

fullFORTH+ for APPLE/PET 

FULL FIG FORTH implementation plus 
conditional assembler, floating point, 
string handling, multidimensional arrays 
and disk virtual mamory 
fullFORTH t from IDPC Co $100 

Target Compiler S 50 



P.O.Box 102 
Langhorne, Pa. 19047 
5-757-0284 



SEE YOUR DEALER OR: 



macao- 



rMICROTECH) La 

> ^ 21 

DEALER INQUIRIES INVITED 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



63 



^ , 1 




Bcommodore 



INTERFACES 

ADA-1450 Serial S149 

AOA-1 600 Parallel 149 

RS232caDleforVicor64, 2nn 30 

Video/Audio cable for 64 & monitor 25 

MONITORS — Great resolution 
for the CBM 64 or VIC 

Panasonic, 13" Color S375 

Amdek Color I 330 

NECJB 1201M, 12" Color 330 

NEC JB 1201, 12" green phosphor 170 

Amdek Video 300L, green phosphor 175 

BUSINESS SOFTWARE 

Spellmaster Dictionary (great tor WordPro') S199 

OZZ Data Base System (8050) 240 

Silicon Oflice (database, wp) 995 ( 

Wdrdcraft 80 289 

VisiCalc (new expanded) 199 

Dow Jones Portfolio Management System (RS232) . , 1 20 

WordPro 4 r or 5 ^ 299 

The Manager 199 

Legal Time Accounting 425 

I.R.M.A 295 

BPI A/R, G/L, Job Cost. Inventory Payroll 325p 

SJB will service any VIC or CBM64. 

MasterCard, Visa, Money Order, Bank Check 

COD (add S5) accepted. 

Add 3% surcharge for credit cards. 

In stock items shipped within 48 hours, FOB., Dallas, TX 

All products shipped with manufacturer's warranty. 

TO ORDER CALL TOLL FREE 
800-527-4893 800-442-1048 (w th in Texas) 

SJB will meet any competitive price under Jn 
similar in-stock conditions. /Jlli\ 

SJB DISTRIBUTORS, INC.^ 

10520 Piano Road, Suite 206 -^ 
Dallas, Texas 75238 ^. 

(214) 343-1328 

Prices are subject to change wittiout notice. bat lu to 



Business Hours; 
M-F 8 to 6 
Sat 10 to 2 



SOFTWARE FOR CBM 64S: 

Word Processing $90 

Computer Tutoring Game (COCO) 50 

General Ledger 199 

Pet Emulator (emulates 4.0 basic) 30 

CBM EasyCalc (for the 64) 99 

CBM EasyFinance 50 

CBM EasyPlot 80 

CBM EasyScan (appointment manager) 80 

Sprite-Magic (build sprites on screen with 

Joystick, save to disk or cassette) 30 

Assembler Package for CBM 64 (cassette) 
Editor (creates and updates source code), 

Assembler, Loader, Disassembler 50 

Mail Mate 50 

IEEE Interface (64) 100 

Parallel Interface 90 

RS232 Interface (modems, printers) 45 

VIC PRODUCTS 

VIC 20 Computer, 5K $199 

Vic Datasette Recorder 60 

Vic1541 Disk Drive 395 

VIC MODEM (for CBM 64) 100 

VIC 1525 Graphic Printer (for CBM 64) 325 

8K Memory Expansion Cartridge 49 

16KRAM 99 

24KRAM 155 

IEEE Interface (VIC) 85 

Gorf (great arcade game) 30 

Omega Race 30 

Midnight Drive 23 

VIC 3 slot Expander 43 

VIC 6 slot Expander 83 

Seawolf 23 

Cosmic Cruncher 23 



Arcade Joysticks — Heavy duty with 2 firing 
buttons! Great for the VIC or 64 

SuperPET (5 languages, 2 processors) 

CBM 8032 Computer 80 column 

CBM Memory Expansion, 64K 

PET 4032, 40 Column 

CBM 8050, 1 Mg Dual Drive 

CBM D9060. 5 Mg Hard Disk 

CBM D9090, 7 5 Mg. Hard Disk 

CBM 4040 340K Dual Drive 

CBM 2031. 170K Single Drive 

PRINTERS — LETTER QUALITY 

CBM 8300.40cps 

Diablo 620,25cps 

Nee Spinwnter 7700,55cps 

Nee Spinwnter 3500,35cps 

PRINTERS — DOT MATRIX 

CBM 4022,80cps,graphics 

CBM 8023,150 cps graphics 

Okidata 82A.120cps/serial or par 

Nee 8023A(parallel) 



MICRO - The 6502/6809 Journal 



No. 55 - December 19! 



AMCRO 

Apple Slices 



By Tim Osborn 



One of the fastest techniques that lets 
you search for a specific occurrence of 
an item within a sorted set is the binary 
search. This month's column presents 
a subroutine (BINARY-SEARCH) that 
you may call from your BASIC pro- 
grams to perform a binary search on a 
sorted (ascending) string array. The ad- 
vantages of a binary search over a serial 
search increase as the number of items 
in the array grows. For example, an ar- 
ray of 4096 items can be searched in 
less than 11 tries. 

The Method 

A binary search tests the middle ele- 
ment in the remaining part of the array. 
If the element is higher than the search 
argument (the value being searched 
for), the part of the array from this ele- 
ment upward is left out of the search by 
resetting the upper limit to the index of 
the element. If the element is lower 
than the search argument, the part of 
the array from this element downward 
is left out by resetting the lower limit 
to the index of this element. The pro- 
gram then finds the average of the up- 
per limit and the lower limit and 
searches the element at this location. 
The procedure continues until the ele- 
ment is found or until it discovers that 
the upper and lower limits have con- 
verged without finding the element. 

The Subroutine 

The syntax for the binary search is: 

& GET (XX$,YY$) 

where 1. XX$ represents any legal 
string array name, and 2. YY$ 
represents any legal string variable 
name. This subroutine will return in 
SS% the index number of the element 
in XX$ that has a value equal to YY$ if 
the item is found. If the item is not 
found the subroutine will return a - 1 





1 
2 


******* 

* 


*********************i 
APPia SUCES 


*** 

* 




3 


* B I 


NARY — SEARCH * 




4 


* 


T. S. 0. 


* 




5 


******************************** 




6 


■ZEHO PAGE FOIRTES 






7 MWTR 


EPZ S9B 


WORK POINTBl 




8 VAfimM 


IFZ 581 


ooNmiNS lAST asm VARIASI£ mame 




9 VABAD 


EPZ $83 






10 cHwarr 


EP2 SBl 


APPUSOfT'S RDOTINE TO GET A BYTE 




11 
12 
13 

14 ; 


EtXftTEE 








^MPERV 


BQU S3F5 


AMPERSAND VECTOR DXATED HERE 




15 FIND 


BQU SE053 


RCXTTINE TO ICCATE '.mRIABLE DESCRIPTOR 




16 chkd™ 


EDu ;debb 


CHECK EDR OPEN PAREN 




17 aTAKfPT BQU SP7D9 


RCXTTINE TO FIND ARRAY DESCRIPTOR 




18 OKCEM 


EDu ;debe 


CHECK EOR COmA 




19 STOEKR 


EDO SDEC9 


DISPIAY SYNTAX ER»3R 




20 [ 

21 

22 


JATR . 


BQU SD995 


MNPtCE TXTPTR TO END OP STATEMENT 


9400 




ORG S9400 




9400 


23 




OBJ S800 


■EDR LISA 


9400 


24 








9400 A9 4C 


25 


Sh'iVUJ 


LDA »$4C 


•JIMP ABSOLUTE INSTHUCTICN 


9402 8D F5 03 


26 




SIR SHPERtf 




9405 A9 10 


27 




LDA tEOTRY 


ISB OP ENTRY ADDRHSS 


9407 8D F6 03 


28 




ST7V AMPERV+1 




940A A9 94 


29 




iTR /onro 


•MSB OP ENTRY ADDRSSS 


940C 8D P7 03 


30 




STTV fMPERV+2 




940F 60 


31 




RTO 




9410 


32 








9410 20 Bl 00 


33 


Einro 


JSR CHHGFT 


•GET CHARACTER 


9413 20 BB DE 


34 




JSR CHKDPN 


;S10ULD BE (5PEN PARBI 


9416 20 09 F7 


35 




JSR GEEARYPT 


;GET ARRAY DESCRIPTOR 


9419 AO 04 


36 




LOT »4 




941B Bl 9B 


37 




LDA (MWrR),Y 


rSHmirn be a one dimqeion array 


941D C9 01 


38 




CMP #1 




941F PC 03 


39 








9421 4C C9 DE 


40 




JMP SniERR 


;E1BE DISPIAY ERROR MESSAGE 


9424 AS 9B 


41 


ENTial 


LDA MWTR 


;SAVE ARRAY DESCRIPTOR ADRS. 


9426 8D 7B 95 


42 




Sin SAVARRAY 


;ISB 


9429 AS 9C 


43 




u» irwTftfi 




942B 8D 7C 95 


44 




SIR SAVABRAY+1 


;MSB 


942E 20 BE DE 


45 




JSR OIKCCM 


;CHK FOR COfWA + iriAD A W/NEJCT BYTE 


9431 85 81 


46 




sm VAraftM 




9433 20 Bl 00 


47 




JSR CHRGBT 


;GET NEXT BYTE 


9436 DO 03 


48 




are aiTRY2 


;9iOULD NOT BE END C3F STATEMENT 


9438 4C C9 DE 


49 


ERROR 


JMP SYNEBR 


;DISPIAY SYNTAX ERROR MESSAGE 


943B C9 24 


50 


HrW2 


CMP »'$■ 


;DOUAR SIOJ 


943D DO 02 


51 




am NAMLNG 


;N0, MUST BE TWO OTARK.-niK NAME 


943F A9 00 


52 




U» »$00 




9441 09 80 


53 


NAMUG 


ORA #580 


INEEATIVE ASCII 


9443 85 82 


54 




STTl VAKIAMU 




9445 20 53 EO 


55 




JSR FIND 


;FIND DESCRIPTOR 


9448 AO 02 


56 




LOT #2 




944A Bl 9B 


57 




LDA (MWrR),Y 


;CET + SAVE THE 


944C 8D 74 95 


58 




ST!\ VABIH 


;LB«3IH OP PASSED STRING 


944PC8 


59 




INY 




9450 Bl 9B 


60 




LDA (UWrR),Y 


;GET + SAVE THE 


9452 85 83 


61 




ST7V VARAD 


;ADCRESS C3F PASSS) STRING 


9454 C8 


62 




INY 




9455 Bl 9B 


63 




ITR (UWrR),Y 




9457 85 84 


64 




STA VABAI>H 




9459 AD 7B 95 


65 




LDA SAVARRAY 


;R^STBBLISH WWTR TO 


945C 85 9B 


66 




S™ UWTR 


;ADCRESS OP ARRAY !3ESCRlflUK 


945E AD 7C 95 


67 




LDA SAVABRAY+1 




9461 85 9C 


68 




sm irWTR+l 




9463 AO 05 


69 




LOT #5 


;CET UPPER UM. OP DIM (lOH BYTE) 


9465 Bl 9B 


70 




LDA (MWrR),Y 




9467 8D 78 95 


71 




sm upuMH 


jMUCE IOW-HI(H 


946AC8 


72 




INY 




9468 Bl 9B 


73 




UA (MWrR),Y 




9460 BD 77 95 


74 




ST* UPUM 




9470 A9 00 


75 




UA »$00 


: INITIALIZE UWER LIMIT 


9472 8D 79 95 


76 




STA I£MLIM 




9475 8D 7A 95 


77 




STA WWUM4-1 




9478 20 31 95 


78 


SSUOILF JSR COMPIIK 


;INDElC=(UPLIM+I£IWLIM)/2 


947B 20 56 95 


79 




JSR BY3 


:MULTIPUf mDEX BY 3 (UNSIH OP PTR. f 


947E 18 


80 




oc 




947P A5 9B 


91 




LDA UKTR 


;ADD BASE TO INDEX 


9481 6D 7B 95 


82 




ADC SAVARRAY 




9484 85 9B 


83 




Sm UKTR 


:TO OBTMN POINTEF; TO EUMENT 


9486 A5 9C 


84 




LEA irWTR+l 




9488 6D 7C 95 


85 




ADC SAVABRAY+1 




948B 85 9C 


86 




Sm MWTRH 




948D AO 07 


87 




LDY #7 


rOFPSBT TO IZNOIH OP EUMENT 


948F Bl 9B 


88 




LDA (MWrR).Y 




9491 8D 7D 95 


89 




ST* AHRAYIN 




9494 CD 74 95 


90 




CMP VARIN 


:FIND SHORTEST ABCHJMENT 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



65 



9497 30 06 


91 




BMI AiSHAXST 


ELEMENT SHORTEST 


9499 AE 74 95 


92 




UK VARUf 


SnONG SHORIEST 


949C 4C AO 94 


93 




JMP cowri 




949F AA 


94 


ABHAXST 


TAX 


PUT ELEMENT LJSSIH IN X 


94A0 ca 


95 


CXWTl 


INY 


OFPSBT TO ADDRESS 


94A1 Bl 9B 


96 




U» (LOWTR),Y 


GET LOW BYTE OF ADDRESS 


94A3 SD 7F 95 


97 




Sm ARRAYAD 




94A6 ca 


98 




INY 




94A7 Bl 9a 


99 




u» (uwm),Y 


GETHIffl BYTE 


: 94A9 30 80 95 


100 




sm ABRAYADt-l 




94JC AO 00 


101 




UW »S0O 


INITIALIZE Y 


94AE AD 7F 95 


102 




UA ABRAYAD 


SET UP LDWTR AS 


9481 85 9B 


103 




STA UWTR ; 


ZERO PAGE PTR. EDR ARRAYM) 


9483 PD 80 95 


104 




U» AFlRAYRIH-1 




94B6 85 9C 


105 




STA IDWnM-1 




94BS Bl 9B 


106 


CCMPLP 


Ufi (UWrR),Y ; 


COMPARE ARRAY TO 


94aA Dl 83 


107 




CMP (VARAD) ,Y ; 


STOINS 


94BC 30 2F 


108 




Bm STRNCHI 


STRING IS GREATER 


94aE FO 03 


109 




BB3 OQMPl 




94C0 4C OF 95 


110 




JMP STW*31D : 


STRING IS LOWER 


94C3 C8 


111 


OQMPl 


lOT 




94C4 CA 


112 




DEX 




94C5 DO Fl 


113 




aiE COfPLP 


CONTINUE ODMPARE 


94C7 M) 7D 95 


114 




UA ARRRYUI 




94GA CD 74 95 


115 




CMP VARM 


CCMPARE STOING + EUMEOT UNOH 


94CD 30 IE 


116 




BMI SnWHI 


IF STRING IS UJXIR 


94CF FO 03 


117 




BBO EXIT 


Eomo THE EUMENT 


94D1 4C OF 95 


113 




JMP STWicao 


STRING IS aiOBTBR 


94D4 A9 D3 


119 


EXIT 


U» tSIB 


FIND OR CREATE A DESCRIPTOR 


94D6 35 81 


120 




STA VABNAM 


EDR SS% INTEGER 


94D8 85 32 


121 




sm VABNAMtl 




940A 20 53 EO 


122 




JSR PIUD 


BY JSR TO FIND 


94DD AO 02 


123 




LDY t2 




94DF AD 76 95 


124 




UA INDEX+1 


STORE HICH BYTE OP INDEX 


94E2 91 9B 


125 




sm (icwrR),Y 


FIRST 


94E4 C8 


126 




INY 




94E5 AD 75 95 


127 




UA INDEX ; 


ViW tow BYTE 


94E8 91 9B 


128 




STA (UWTRj.Y 




94EA 4C 95 D9 


129 




JMP DAm 


RESET TXTPTR + RBIUW TO BASIC 


94ED AD 79 95 


130 


STBMJII 


U» IDMUM ; 


IF lOMUM = INDEX 


94P0 CD 75 95 


131 




CMP INDEX ; 


THAN ELEMHJT CAN'T BE PDUID 


94P3 DO OB 


132 




BSE HI2 




94F5 AD 7A 95 


133 




U» IDWtm<-l 




94F8 CD 76 95 


134 




CMP INDEX+1 




94ra DO 03 


135 




arEHI2 




94FD 4C 4B 95 


136 




JMP NOTPOUND 


SO BRANCH TO MOTEOIM) RIN. 


9500 AD 75 95 


137 


HI2 


UA INDEX 


RESET LOWER UMIT 


9503 8D 79 95 


138 




SIR UMUM 




9506 AD 76 95 


139 




U» n»EEX+l 




9509 8D 7A 95 


140 




sm iTHumi 




95QC 4C 78 94 


141 




JMP SB«HLP 


QOWTINUE SEARtH 


950F AD 77 95 


142 


smmsm 


UA UPUM 


IF UPUM=INDEX 


9512 CD 75 95 


143 




CMP INDEX 


THEM ELEMEMT CAN'T BE EDUJD 


9515 00 OB 


144 




are ID2 




9517 AD 78 95 


145 




UA upum-i 




951A CD 76 95 


146 




CMP INDEX+1 




951D DO 03 


147 




are ID2 




95 IF 4C 4B 95 


148 




JMP NOTIOUND 


SO BRANCH TO WDTODIMD ROOTINE 


9522 AD 75 95 


149 


LD2 


UJV INDEX ; 


RESET UPPER UMIT 


9525 8D 77 95 


150 




sm UPUM 




9528 AD 76 95 


151 




UJV INDEX+1 




952B 8D 78 95 


152 




sm upuM+1 




952E 4C 7a 94 


153 




JMP SBUCHLP 


oownma; seakh 


9531 


154 








9531 


155 


tccmpote nw index 




9531 18 


156 


OCMPIOC 


OC 


INraX={ UPUM+IDMUM) /2 


9532 AD 77 95 


157 




U» UPUM 


ADD UPUM TO lOWUM 


9535 6D 79 95 


158 




ADC lOWLJM 




9538 8D 75 95 


159 




sm INDEX 


AND STOR IN INDEX 


953B AD 78 95 


160 




U3A UPUM+l 




953E 6D 7A 95 
9541 8D 76 95 


161 




ADC ICWUM+l 




162 




sm INDEX+1 




9544 4E 76 95 


163 




ISR INDEX+1 


DIVIDE BY TWO 


9547 6E 75 95 


164 




ROR nCEX 




954A 60 


165 




Bns 




954B A9 FP 


166 


NDITOCND UJV t$PP 


-1 MEANS NOnKHMD 


9540 8D 75 95 


167 




sm INDEX 




9550 8D 76 95 


168 




sm INDEX+1 




9553 4C D4 94 


169 




JMP EXIT 




9556 


170 








9556 AD 75 95 


171 


an 


ujv ncEx 


rxwm=( INDEX'S) 


9559 85 9B 


172 




sm UWTR 




955B 06 9B 


173 




ASL UWTR 


(ICWrR*2) 


955D AD 76 95 


174 




UA INDEX+1 




9560 85 9C 


175 




sm MWTR+1 




9562 26 9C 


176 




BDL MWTftfl 




9564 13 


177 




CIC 




9565 AD 75 95 


178 




U» INDEX =tP 


sm lOWTH 


956C AD 76 95 


181 




U» INDEX+l 




956F 65 9C 


182 




ADC t£wn»+i 




9571 35 9C 


183 




sm irwmn 




9573 60 


184 




Rns 




9574 


185 








9574 


186 


;INTEraaL SIDRAIX AREAS 




9574 


187 








9574 


188 


VAHLN 


DFS $1 


VARIABLES I^KTIH 


9575 


189 


INDEX 


DFS ?2 


SBSBCH INDEX 


9577 


190 


UPUM 


DFS S2 


HKHEST POSSIBLE fCSinCN FOR SERBtH 


9579 


191 


MWUM 


DFS $2 


MWEST POSSIBM POSITION EOR SEARCH 


957B 


192 


SAVABBKf DFS $2 


VOUC AHBk 


957D 


193 


KSBKntI 


DFS 52 


LESOM CP GUBBEOT ARRAY EiaEWT 


957F 


194 


ABHMAD 


WS $2 




9581 


195 








9581 


196 




aro 





66 



MICRO - The 6502/6809 Journal 



in SS%. To use the & feature you must 
BRUN the object program. The other 
choice is to BLOAD the program and 
use CALL -27632 in place of the 
ampersand. This will allow you to use 
this subroutine in conjunction with 
another ampersand routine. 

Upon entering the subroutine at 
ENTRY the TXTPTR (see July Apple 
Slices for an explanation of TXTPTR, 
FIND, CHRGET, DATA, and VAR- 
NAM) is advanced to point at the first 
character past the GET token. Next, a 
JSR to CHKOPN (an Applesoft built-in 
routine) is performed, which checks for 
an open parenthesis. The JSR to GET- 
ARYPT (Applesoft built-in routine) 
returns with the address of the descrip- 
tor for XX$ in LOWTR |9B$ - 9C$). If 
the array cannot be found an "OUT OF 
DATA IN LINE nnn" error message is 
produced. 

Lines 36-40 check the number of 
dimensions to be sure that this is a one- 
dimensional array. If it is not, a syntax 
enor message is produced (line 40) . The 
array descriptor address is then saved 
for future use in SAV ARRAY (lines 41 
through 44). A JSR to CHKCOM en- 
sures that a comma separates the two 
parameters and loads the accumulator 
with the first byte following the com- 
ma. This byte is stored at VARNAM. 
Lines 47 through 54 load VARNAM + 
1 with either the negative ASCII of the 
second byte of the two-byte or longer 
variable name, or $80 if the variable 
name is only one byte long, 

A JSR to FIND loads LOWTR with 
the address of the descriptor of the 
passed variable. Lines 56 through 64 
load and save the length and address of 
the passed variable in VARLN and 
VARAD respectively. Lines 65 through 
74 re-establish LOWTR to the address 
of the array's descriptor (SAV ARRAY) 
and initialize the upper limit (UPLIM) 
to the size of the array. The lower limit 
jLOWLIMj is then initialized to zero, 
and the main search loop (SEARCHLPj 
is entered. First there is a JSR to 
COMPIDX, which is an internal rou- 
tine that takes the average of the upper 
and lower limits and stores the result 
at INDEX. INDEX will be used as the 
current position in the array of the 
binary search. 

Now SEARCHLP takes the current 
value of the INDEX field and multiplies 
it by three (JSR BY3), placing the result 
in LOWTR. This is done because each 
string element in the array has a three- 
byte entry in the array descriptor, s 



No. 55 - December 1982 



length byte followed by a two-byte 
address. To find the displacement of 
the individual element's entry from the 
base address of the array's descriptor, 
it is necessary to multiply INDEX 
by three. 

LOWTR is then added to the base 
address of the array's descriptor 
(SAV ARRAY); the result is stored back 
in LOWTR. The length of the searched 
element is then found and saved in 
ARRAYLN (lines 88 through 89). The 
seven-byte Y-index value is needed 
because the individual string array en- 
tries start seven bytes from the begin- 
ning of the array descriptor in any one- 
dimensional array. The X- register will 
be used as the number of bytes left in 
the array element and string variable to 
compare. It is initialized to the lower of 
the VARLN and ARRAYLN internal 
parameters [lines 90 through 94). 

Next, the address of the array ele- 
ment is found and placed in LOWTR 
(lines 95 through 104), The compare 
loop (COMPLP) then compares the ar- 
ray element to the string variable, byte 
for byte, up to the length of the shortest 
of the two elements (using the 



X-register as a counter). If the string is 
lower in value than the array element a 
JMP to STRNGLO is performed (line 
110). If the string is higher in value, 
then a [MP to STRNGHI is performed 
(line 108). If the two items are equal 
(line 109) the lengths are compared. If 
the string is shorter it is considered to 
be lower in value and a JMP to 
STRNGLO is performed (line 116). If 
the two items are of equal length then a 
branch to EXIT is performed, which 
sets up an integer variable SS% and 
loads it with the current value of IN- 
DEX. This value is the location of the 
search argument in the array. The last 
thing EXIT does is JMP to DATA, 
which is Applesoft's routine to advance 
the TXTPTR to the end of the current 
statement (lines 119 through 129). 

STRNGHI first compares the lower 
limit of the search (LOWLIM) to the 
INDEX. If they are equal then the upper 
limit and the lower limit have con- 
verged, which means the element 
could not be found. Under this condi- 
tion a JMP to the internal routine NOT- 
FOUND is performed (lines 130-136). 
NOTFOUND loads INDEX with a - 1 



and JMPs to EXIT where INDEX is 
passed to the SS% parameter as de- 
scribed above. 

If the upper and lower limits have 
not converged, STRNGHI then resets 
the lower limit by moving INDEX 
(lines 137 through 140). STRNGHI 
then returns to the main search loop 
(SEARCHLP) to continue the search. 

STRNGLO works essentially like 
STRNGHI except it tests for con- 
vergence by checking to see if INDEX is 
equal to the upper limit. If it is not, 
STRNGLO resets the upper limit to 
INDEX instead of the lower limit. 

Subroutine Hints 

Before using BINARY-SEARCH you 

should set HIMEM to 37888 or lower (if 

you decide to load the routine at 

$9400). I could have set HIMEM for 

you in SETVEC, but I believe that 

leaving this task to you allows more 

flexibility; you can BLOAD and CALL 

the routine instead of using the & 

feature. You can also BRUN the 

subroutine from anywhere in your 

BASIC program, instead of just from 

the first line. 

iMCftO 



ANNOUNCING A NEW JOURNAL 
DEVOTED TO ALL ASPECTS 
OF MICROCOMPUTER 
J^ USE AT THE 






UNDERGRADUATE 
LEVEL 



PREMIER 
ISSUE 
FEBRUARY 1983 



<i 



^ 



wr I te : 

Collegiate Microcomputer 
Rose-Hulman Institute of Technology 
Terre Haute IN 47803 USA 

Prospectus sent upon request. 



Uttcision 
OyBtems 



D«ci«ion SytMmi 

P.O. Box 13006 
D«nton. TX 76203 



SOFTWARE FOR THE APPLE W" 

ISAM-DS is an integrated sei of Applesoft rou'ines ihat gives indexed U\e capabilities 
to your BASIC programs. Retrieve by key, partial key or sequentially Space from 
deleted records is automatically reused Capabilities and performance that match 
products costing twice as much. 
(SO Disk. Applesoft. 

PBASIC-DS is a sophisticated preprocessor for structured BASiC Use advanced 
logic constructs such as IF .ELSE... CASE, SELECT, and many more. Develop 
programs for Integer or Applesoft. Enjoy the power of structured logic at a traction of 
Ifw cost of PASCAL. 
»35. Disk, Applesoft (48K. ROM or Language Card) 

OSA~DS IS a dis-assembler for 6502 code Nona/ you can easily dis assemble any 
machine language program tor ihe Apple and use the dis- assembled codt direciiy as 
input to your assembler Dis-assernbles instructions and data. Produces code com 
patible with the S-C Assembler [version 4 0), Apple s Toolkit assembler and others 
»25 Disk. Applesoft (32K, ROM or Language C.jrdi 

FORM-DS is a complete system for trie definition ot input and output froms. FORM- 
DS supplies the automatic checking of numeric inout tor acceptable range of values, 
automatic formatting of numeric output, and many more teatures 
$2S Disk. Applesoft (32K, ROM or Language C;irdl 

UTIL-DS is a set of routines for use vA^ith Applesott loformat numeric output, selec 
lively clear variables (Applesoft's CLEAR gets everything), improve error handling, 
and iriierface machine language NA/ilh Applesoft programs. Includes a special load 
routine for placing machine language routines underneath Applesoft programs 
525 Disk, Applesoft 

SPEED-DS IS a routine to modify the sialemeni linkage in an Applesoft program lo 
speed its execution improvements ot 5-20% are common As a bonus, SPEED DS 
includes machine language routines to speed snng hand*»ng and reduce ^he need 'o' 
garbage clean-up Author Lee Meador 
»1S Disk. Applesoft (32K, ROM or Language CSfd) 



(Add M.OO for Foreign Mail) 
'Apple II is » registered trademark of the Appln Computer Co 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



67 




BOX 120 

ALLAMUCHY, N.J. 07820 

201-362-6574 



HUDSON DIGITAL ELECTRONICS INC. 



THE TASK* MASTERS 



HDE supports the *TIM, AIM, SYM and KIM (TASK) with a growing line of computer programs and 
peripheral components. All HDE component boards are state-of-the-art 4y2" x 6y2", with on board 
regulation of all required voltages, fully compatible with the KIM-4 bus. 



OMNIDISK 65/8 and 65/5 

Single and dual drive 8" and SVa" disk systems. 
Complete, ready to plug in, bootstrap and run. 
Include HDE's proprietary operating system, 
FODS (File Oriented Disk System). 



HDE DISK BASIC 

A full range disk BASIC for KIM based systems. 
Includes PRINT USING, IF . . . THEN . . . ELSE. 
Sequential and random file access and much 
more. $175.00 



DM816-M8A 

An 8K static RAM board tested for a minimum of 
100 hours and warranted for a full 6 months. 



HDE ADVANCED INTERACTIVE 
DISASSEMBLER (AID) 

Two pass disassembler assigns labels and con- 
structs source files for any object program. 
Saves multiple files to disk. TIM, AIM, SYM, KIM 
versions. $95.00 



DM816-UB1 

A prototyping card with on-board 5V regulator 
and address selection. You add the application. 



HDE ASSEMBLER 

Advanced, two pass assembler with standard 
mnemonics. KIM, TIM, SYM and KIM cassette 
versions. $75.00 ($80.00 cassette) 



DM81 6-P8 

A 4/8K EPROM card for 2708 or 271 6 circuits. 
On board regulation of all required voltages. 
Supplied without EPROMS. 



DM816-CC15 

A 15 position motherboard mounted in a 19" 
RETMA standard card cage, with power supply. 
KIM, AIM and SYM versions. 



DISK PROGRAM LIBRARY 

Offers exchange of user contributed routines 
and programs for HDE Disk Systems, Contact 
Progressive Computer Software, Inc. for details. 



HDE TEXT OUTPUT PROCESSING SYSTEM 
(TOPS) 

A comprehensive text processor with over 30 
commands to format and output letters, docu- 
ments, manuscripts. Kl M, Tl M and Kl M cassette 
versions. $135.00 ($142.50 cassette) 

HDE DYNAMIC DEBUGGING TOOL (DDT) 

Built in assembler/disassembler with program 
controlled single step and dynamic breakpoint 
entry/deletion. TIM, AIM, SYM, KIM AND KIM 
cassette versions. $65.00 ($68.50 cassette) 

HDE COMPREHENSIVE MEMORY TEST 
(CMT) 

Eight separate diagnostic routines for both 
static and dynamic memory. TIM, AIM, SYM, 
KIM and KIM cassette versions. $65.00 ($68.50 
cassette) 



AVAILABLE DIRECT OR FROM THESE FINE DEALERS: 



Progressive Computer Software 
405 Corbin Road 
York, PA 17403 
(717)845-4954 



Johnson computers 

Box 523 

Medina, Ohio 44256 

(216)725-4560 



Lux Associates 
20 Sunland Drive 
Chico, CA 95926 

(916)343-5033 



Falk-Baker Associates 

382 Frankiin Avenue 

Nutley, NJ07110 

(201)661-2430 

Laboratory Microcomputer Consultants 

P.O. Box 84 

East Amherst, NY 14051 

(716)689-7344 



Perry Periptierals 

P.O. Box 924 

Miller Place, NY 11764 

(516)744-6462 



Adding Voice to a Computer 

by Michael E. Valdez 



A low-cost procedure for 
sampling and reproducing voice 
with a computer including the 
required hardware and software. 

Voice 

requires: 

A computer with a 4-bit port 
available and a Motorola 3417 
speech/digital converter 

Several methods are available today to 
add voice to a computer. The method 
developed by Texas Instruments uses a 
model of the mouth and generates the 
necessary parameters by linear predic- 
tive coding. This method gives excel- 
lent results producing isolated words 
with very high quality, but is expen- 
sive. Another problem is that it is 
necessary to have a read-only memory 
with the parameters of the words to be 
used; this read-only memory can be 
produced only by Texas Instruments. It 
has several ready-made, read-only 
memories with standard vocabularies 
at a very reasonable price. Using this 
method requires minimal knowledge of 
acoustics and linguistics. The user has 
to write some simple programs to con- 
trol the unit, the worst requirement be- 
ing to prevent the words from running 
together. 

The signal compression and delta 
modulation method developed by Na- 
tional Semiconductors, although very 
different technically, is similar from 
the user's point of view to the one 
developed by Texas Instruments. With 
this method it is also necessary to use a 
read-only memory produced by the 
manufacturer, and the cost is also in 
the same range (around two hundred 
dollars). But, the results are somewhat 
robotic. 

A continuously variable slope delta 
modulation developed by Motorola 
uses the same integrated circuit for 
storing and reproducing speech. This is 



the only method available today that 
permits the user to sample his own 
speech. The unit to be described in this 
article is inexpensive (fifteen dollars for 
parts), and the knowledge require- 
ments of acoustics and linguistics are 
minimal. The user should know how to 
use a tape recorder and write some sim- 
ple programs. The hardest requirement 
is the timing of the loops. The quality 
of reproduction is quite good and 
depends heavily on the quality of the 
tape recording equipment. The digital 
data can be stored in read-write or read- 
only memory, or it can be saved on 
magnetic tape or disk. 

The phoneme concatenation 
method uses the SCOl phoneme syn- 
thesizer developed by Votrax. The 
results of this procedure are mechani- 



cal but it is important to recognize that 
this is the only real synthesis procedure 
for the production of speech by a com- 
puter; that is, it is not necessary to 
sample speech to obtain data to be 
reproduced by the computer as in the 
other methods. The voice is generated 
by entering numbers into the computer 
and the SCOl, or any other device. 
Naturally, since this method does not 
reproduce speech, the generated voice 
does not resemble the voice of the 
operator, or anybody else. In its most 
elementary use, the voice can be 
described as robot-like because of the 
lack of intonation and inflections. With 
additional work and knowledge, it is 
possible to obtain better results. The 
cost of a simple unit is under one hun- 
dred dollars. The use of this method re- 



Listing 1: 


Program 


for Adding Voice to a Computer 




looo: 






2 


ORG $1000 




looo: 






3 


« MODIFY TO SUIT INSTALLATION 


looo: 






<» 


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 


looo: 






5 


X 


X 


looo: 






i 


X 


X 


looo; 






7 


X PROGRAM TO ADD VOICE 


TO ANY X 


looo: 






8 


X 


X 


looo: 






9 


X 


X 


looo: 






10 


X COhPUTER 


X 


looo: 






11 


X 


X 


looo: 






12 


X 


X 


lOoo; 






13 


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 


looo: 






1-* 


hSB OFF 




looo: 






15 


X 




looo; 






li 


X STORAGE LOCATION MUST BE hODIFIED 


looo: 






17 


X TO SUIT SYSTEM 




looo: 






18 


X 




ooio: 






19 


PNT EOU $10 




0012; 






20 


END EOU $12 




0011; 






21 


BITS EQU til 




1000: 






22 


X 




1000: 






23 


X SYSTEM SUBROUTINES 




1000: 






2'\ 


X 




F8B2! 






25 


KKK EQU ♦F8B2 


KEYBOARD INPUT IN ASCII 


fa5f: 






26 


OUT EQU ♦FA5F 


OUTPUT IN ASCII 


1000; 






27 


X 




1000: 






28 


X LOCATIONS OF I/O PORT 


1000: 






29 


X 




EFBO: 






30 


DELR EQU tEFBO 


6522 PORT 


EF82: 






31 


DELDR EQU ♦EF82 


6522 DATA DIRECTION REGISTER 


1000: 






32 


X 




1000: 






33 


X 




1000: 






3-* 


X PROGRAM START 




1000! 






35 


X 




1000: 






36 


X 




1000: 


A2 


00 


37 


DELTA LDX *0 


BEGINNING OF BUFFER 


1002: 


EiD 


52 11 


38 


DELI LDA DLM.X 




1005: 


C9 


IF 


39 


CMP *$1F 




1007: 


FO 


Oi 


10 


BEQ DELI 


(continued) 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



69 



quires some knowledge of linguistics 
and phonetics if good results are 
desired, but the manufacturer provides 
substantial support. 

Intel has developed what they call 
an analog microprocessor — a single- 
chip device to work with analog 
signals. This unit, the 2920, can be 
used for speech synthesis or reproduc- 
tion, but its use is limited to those per- 
sons with a substantial knowledge of 
acoustics, linguistics, physics, mathe- 
matics, and a high level of program- 
ming proficiency. This unit is for the 
serious user. There are several other 
units in this category, manufactured by 
TRW, Harris, and others. 

The Motorola 3417 

The Motorola 3417 is a linear 
bipolar chip housed in a 16-pin dual in 
line package, which is compatible with 
both TTL and CMOS technologies. The 
16-pin package makes it easy to mount 
since sockets are available everywhere. 
The chip has the circuitry for the en- 
coder (speech to digital) and decoder 
(digital to speech) conversions. 

Pins 1 and 7 are the speech input 
and output while pins 13 and 9 are the 
digital input and output, respectively. 
Data then travels in the chip from pin 1 
to pin 9 or from pin 13 to pin 7 depend- 
ing on the input to pin 15, encode/ 
decode. A high in pin 15 makes the chip 
encode the speech input to pin 1 giving 
a digital output through pin 9. A low in 
pin 15 converts digital input through 
pin 13 to a speech output in pin 7. 

The chip provides for positive and 
negative excursion oi the speech signal 
with a regulated voltage at half of the 
supply voltage that is used as zero for 
the speech input or output. The chip 
also provides pin 12 to set the threshold 
between digital zero and one, to adjust 
the chip to different technologies. The 
feedback point of the output amplifier 
is accessible in pin 6 to include a filter 
if desired. Pins 3, 4, and 11 provide ac- 
cess to the integrator to permit the ad- 
dition of a syllabic filter. The Motorola 
3417 works with a single supply 
voltage and requires a 16 Khz clock in- 
put at pin 14. 

The data sheet provides a full ex- 
planation of the theory of continuously 
variable delta modulation as well as a 
variety of circuit information. 

Haidwaie 

For reasons of simplicity and low 
cost, the unit described in this article 



Listing 1 

10 09:20 

iooc:e8 

lOODiDO 
lOOFJAV 
1011 :8D 
lOltiZO 

ioi7:do 
1019: 

1019:60 

ioia:c9 
ioic:fo 
ioie:a5 

1020:85 
1022;A5 
102^:85 
1026:a2 
1028: BO 
102E::C9 

io2d:fo 

102F:20 
1032:E8 
1033:dO 

1035:20 

1038;A2 

io3a:b[) 

103D:C9 

io3f:fo 
10^1:20 
io44:e8 
iO'^5:do 
10^7:20 
104a:c9 
iO'^c:fo 
io^e:c9 

1050; DO 

1052; 

1052; 

1052: 

1052; 

1052: 

1052;A2 

10 51: ED 

1057:C9 

1059;F0 

105B:20 

105E:E8 

io5f:do 

106i:20 
106');A9 
1066;8D 
1069:A0 

ioab:a2 

106D;A9 
106F:8D 
lfl72:EA 
1073:EA 

io7i:ad 

1077;^A 
1078:26 
107A:A9 
107C:8D 

107f:ca 
iogp;Do 

1082;A5 
108t:91 
1086;E6 
1088:dO 
108A:E6 
108C;38 
108D:A5 
108F:E5 
1091:A5 
1093:E5 
1 095; BO 
1097:iC 

io9a:ai 
io9c:ai 
io9e;ai 
ioao:ai 

10A2:B5 

10At:B5 

10A6:^C 

10A9; 

10A9: 

10A9: 

10A9: 

10A9: 

10A9:A9 

ioAe;8D 



(continued) 
5F FA tl 
'(2 

ts 
^^ 
ts 

'(6 
^7 
^8 

'(9 



F3 
OE 
82 
02 
01 



EF 

11 



FF 
lA 
13 

11 

12 

10 

00 

FA 11 

IF 

06 

5F 



FA 



11 



FA 



F8 



F3 
02 
00 
El 
IF 
06 
5F 

F3 
E2 

5B 
^9 
E6 



00 

16 12 
IF 
06 
5F FA 

F3 
E2 F8 

oc 

80 EF 
00 
08 
01 
80 EF 



80 EF 



11 
oc 

80 
18 

11 

10 
10 
02^ 

11 



EF 



12 
10 
13 

11 

D1 
00 10 

11 
11 
11 
11 
11 
11 

6D 10 



00 
80 EF 



50 

51 

52 

53 

51 

55 

56 

57 

58 

59 

60 

61 

62 

63 

61 

65 

66 

67 

68 

69 

70 

71 

72 

73 

71 

75 

76 

77 

78 

79 

80 

81 

82 

83 

81 

85 

86 

87 

88 

89 

90 

91 

92 

93 

91 

95 

96 

97 

98 

99 

100 

101 

102 

103 

101 

105 

106 

107 

108 

109 

110 

111 

112 

113 

111 

115 

116 

117 

118 

119 

120 

121 

122 

123 

121 

125 

126 

127 

128 

129 



JSR OUT 
INX 
BNE 
LDA 
STA 
JSR 
BNE 

X PROGRAM ENDS WHEN 
RTS 
CMP 
BECl 
LDA 
STA 
LDA 
STA 
LDX 
LDA 
CMP 
BEO 
JSR 
INX 
BNE 
JSR 
LDX 
LDA 
CMP 
BEQ 
JSR 
INX 
BNE 
JSR 
CMP 
BEQ 
CMP 
BNE 



DELI 



DEL2 



DELS 



DEL6 
DELS 
DEL7 



DELS 



DELI 

**E 

DELDR 

ADRS 

DEL2 



*«FF 

DELS 

END+1 

PNT + 1 

END 

PNT 

to 

DLM3,X 
**1F 
DEL6 
OUT 

DEL5 
ADRS 

to 

DLMl.X 
t«lF 
DELS 
OUT 

DEL7 

KKK 

t«1F 

OUTPUT 

tt19 

DEL3 



X INPUT ROUTINE 



INPO 



INP1 



INPUT 
INPl 



LDX 
LDA 
CMP 
BEO 
JSR 
INX 
BNE 
JSR 
LDA 
STA 
LDY 
LDX 
LDA 
STA 
NOP 
NOP 
LDA 
LSR 
ROL 
LDA 
STA 
DEX 
BNE 
LDA 
STA 
INC 



INITIALIZE PORT 

THE INITIAL ADDRESS IS ZERO 
STANDARD FILE 
MOVE TO POINTER 

END OF BUFFER 



to 

DLM2,X 
t«lF 
INPl 
OUT 

INPO 
KKK 
t«C 
DELR 

to 

t8 
♦ 1 

DELR 



DELR 

A 

BITS 

♦»C 

DELR 

INP3 
BITS 
(PNT>,Y 
PNT 



INP2 



INP3 



BNE 1NP2 

INC PNT+1 

SEC 

LDA 

SBC 

LDA 

sec 

BCS 
JMP 
LDA 
LDA 
LDA 
LDA 
LDA 
LDA 
JMP 



END 

PNT 

END+1 

PNT + 1 

INPUT 

DELTA 

<6ITS,X 

<BITS,X 

(BITS,X 

(BITS,X 

BITS,X 

EITS,X 

INPl 



INPUT OR OUTPUT? 



ASCII 
ASCII I 



SIGNAL WHEN READY 



START CLOCK 



EIGTH BITS 
CLOCK LOW 

DUMMY 

DUMMY 

GET NEXT BIT 

MOVE TO CARRY FLAG 

ASSEMBLE WORD 

CLOCK HIGH 

COUNT BITS 
CYCLE EIGHT TIMES 
REGOVER WORD 
SAVE IN BUFFER 
INCREMENT POINTER 



TEST FOR BUFFER FULL 



GO BACK FOR MORE 

END 

DUMMY 

DUMMY 

DUMMY 

DUMMY 

DUMMY 

DUMMY 

CONTINUE 



X OUTPUT ROUTINE 



OUTPUT 



LDA 
STA 



to 

DELR 



CLOCK LOW 



70 



MICRO - The 6502/6809 Journal 



No. 55 - December 1 = 



Listing 1 


(continued) 










ioae:a2 


00 




130 




LDX 


*0 


SIGNAL WHEN READY 


iobo:ed 


16 


12 


131 


OUTt 


LDA 


DLM2,X 




10E;3;C9 


IF 




132 




CMP 


*«1F 




ioe;5:fo 


06 




133 




EEQ 


0UT5 




1067:20 


5F 


FA 


13t 




JSR 


OUT 




ioea:e8 






135 




INX 






10EiB;DO 


F3 




136 




ENE 


OUTt 




ioed;2o 


E2 


F8 


137 


0UT5 


JSR 


KKK 




ioco:ao 


00 




138 




LDY 


*0 




1GC2:E:1 


10 




139 


OUTO 


LDA 


(PNT) ,Y 


GET NEXT WORD 


10C^:85 


1^ 




ito 




STA 


BITS 


SAWE IT IN BITS 


10C6:E6 


10 




Itl 




INC 


PNT 


INCREMENT POINTER 


ioca;Da 


02 




lt2 




BNE 


OUTl 




ioca:e6 


11 




lt3 




INC 


PNT + 1 




iacc;A2 


08 




Itt 


OUTl 


LDX 


*8 


SEND EIGHT BITS 


iacE:A9 


08 




Its 


0UT2 


LDA 


*8 


CLOCK HIGH 


10D0:8D 


80 


EF 


lt6 




STA 


DELR 




10D3:A9 


02 




lt7 




LDA 


*2 


PREPARE ACCUMULATOR 


1GD5:06 


1^ 




lt8 




ASL 


BITS 


GET BIT 


10D7:2A 






lt9 




ROL 


A 


INTO ACCUMULATOR 


10D8;2A 






150 




ROL 


A 


SHIFT ONE MORE 


10D9;8D 


8 


EF 


151 




STA 


DELR 


SEND TO 3tl7 


10DC:29 


02 




152 




AND 


*2 


CLEAR CLOCK 


lODEJSD 


80 


EF 


153 




STA 


DELR 


CLOCK LOW 


10Ei:CA 






15t 




DEX 




EIGHT BITS? 


ioe2:do 


OE 




155 




ENE 


0UT3 


GO FOR MORE 


10E^:38 






156' 




SEC 




TEST FOR BUFFER FULL 


10E5:A5 


* -7 




157 




LDA 


END 




10E7:E5 


10 




159 




SEC 


PNT 




10E9:A5 


13 




157 




LDA 


END+1 




iaEE::E5 


11 




160 




SEC 


PNT + 1 




i()ed:bo 


D3 




161 




ECS 


OUTO 


GO FOR MORE 


ioef:^c 


00 


10 


162 




JMP 


DELTA 




iof2:ai 


1^ 




163- 


0UT3 


LDA 


(BITS,X) 


DUMMY 


iuF'1:ai 


1^ 




16t 




LDA 


(EITS.X) 


DUMMY 


iof6:ai 


1^ 




165 




LDA 


(BITS.X) 


DUMMY 


lOFSIBl 


1^ 




166 




LDA 


(BITS),Y 


DUMMY 


iaFA;B5 


1^ 




167 




LDA 


EITS,X 


DUMMY 


iofc:e5 


It 




168 




LDA 


BITS.X 


DUMMY 


iofe:ea 






169 




NOP 




DUMMY 


ioff:^c 


CE 


10 


170 




JMP 


0UT2 


CONTINUE 


1102: 






171 


X 








1102: 






172 


X 








1102: 






173 


X GET 


ADDRESS SUBROUTINE 


1102: 






17t 


X 








1102: 






175 


X 








1102:A9 


00 




176 


ADRS 


LDA 


to 




110^:85 


12 




177 




STA 


END 




1106:85 


13 




178 




STA 


END+1 




1108:20 


B2 


F8 


179 


ADRO 


JSR 


h;KK 


GET CHARACTER 


iiob:20 


5F 


FA 


180 




JSR 


OUT 


DISPLAY IT 


iioe:c9 


53 




181 




CMP 


*«53 


CHECK IF S 


iiig:do 


11 




182 




BNE 


ADRl 




1112:A9 


00 




183 




LDA 


♦ 


STANDARD BUFFER 


iim:85 


10 




let 




STA 


PNT 




1116:8^ 


12 




185 




STY 


END 


CHANGE VALUES 


1118:A9 


Ot 




186 




LDA 


*t 




iiia:85 


11 




187 




STA 


PNT + 1 


PER INSTALLATION 


iiic:a9 


to 




188 




LDA 


*«to 




111E:85 


13 




189 




STA 


END+1 




1120:A9 


FF 




190 




LDA 


*«FF 




1122:60 






191 




RTS 






1123:C9 


OD 




192 


ADRl 


CMP 


*«D 


CHECK FOR CAR RET 


1125:F0 


26 




193 




BEQ 


ADRS 




1127:C9 


30 




19t 




CMP 


*«30 


TEST IF NUMBER 


1129:90 


DD 




195 




BCC 


ADRO 


IGNORE IF NOT 


112E:C9 


3A 




196 




CMP 


*$3A 




112D:90 


OC 




197 




ECC 


PKA 




112F:C9 


tl 




198 




CMP 


*«tl 


TEST IF HEXA LETTER 


1131:90 


D5 




199 




BCC 


ADRO 


IGNORE IF NOT 


1133:29 


5F 




200 




AND 


*«5F 


CONWERT TO UPPER CASE 


1'135:C9 


t7 




201 




CMP 


*«t7 




1137:B0 


CF 




202 




BCS 


ADRO 




1139:69 


09 




203 




ADC 


♦ 9 




113B:29 


OF 




20t 


PKA 


AND 


*«F 




ii3d:oa 






205 




ASL 


A 


ROL INTO END, END+1 


ii3e:oa 






206 




ASL 


A 




ii3f:oa 






207 




ASL 


A 




ii')o;oA 






208 




ASL 


A 




ii^i:a2 


Ot 




209 




LDX 


*t 




iii3:oa 






210 


ADR2 


ASL 


A 




111'»:26 


12 




211 




ROL 


END 




11^6:26 


13 




212 




ROL 


END+1 




ii')8:ca 






213 




DEX 






ii^9;do 


F8 




21t 




BNE 


ADR2 




ii^e:FO 


BE 




215 




BEQ 


ADRO 




iiid:a5 


12 




216 


ADR3 


LDA 


END 


GET IF ZERO 


iiif;o5 


13 




217 




ORA 


END+1 


(continued) 


115i:6G 






218 




RTS 




No. 55 - 


December 1982 






MICRO - The 6502/6809 Journal 



uses the Motorola MC3417 continu- 
ously variable delta modulator/demod- 
ulator. The Harris HC55516 could also 
be used but the circuit must be rede- 
signed to account for the fact that the 
55516 is a CMOS chip. If the computer 
to be used has an available port with 
four free bits, very few additional com- 
ponents are needed. Furthermore, none 
of the components shown on the cir- 
cuit is critical and the values can vary 
before the quality of the results is 
degraded. Normally, the noise and the 
quality of the tape recording equipment 
will be the limiting factors for the 
quality of the reproduction. The circuit 
shows part of a 6522 Versatile Interface 
Adapter controlling the 3417, but the 
job can be done with any other pro- 
grammable parallel port, or with three 
flip-flops and one tri-state unit. If the 
program presented with this article is 
to be used, the location of each signal 
in the word must be respected. Bit zero 
is the digital output from the chip, bit 
one is the digital input to the chip, bit 
two is the encode/ decode control, and 
bit three is the clock. Bit zero must be 
programmed as input and the other 
three as outputs. 

One interesting point to mention in 
this circuit is the lack of a clock. The. 
3417 requires a 16 Khz clock; in this 
circuit the clock is produced in soft- 
ware thereby avoiding the problems of 
synchronization. If an independent 
clock is used, it is necessary to sample 
it to send and recover the bits at the 
proper time. 

The audio amplifier shown on the 
circuit is very simple and includes an 
elementary filter to reduce the digitiz- 
ing noise. Notice the capacitor in 
parallel with the speaker for the same 
reason. Some experimentation with the 
values used in a particular circuit 
might improve the quality of reproduc- 
tion. The circuit can be built in the ex- 
isting board of the computer, if there is 
room, or wire wrapped in a small board 
and connected as convenient. Only five 
volts are required to power the unit. 

Software 

The software presented with this ar- 
ticle is self explanatory. The user must 
adjust the memory locations to match 
his system. The subroutine KKK reads 
the keyboard and returns with the 
ASCII character in the accumulator; 
the subroutine OUT displays the 
accumulator. 

The only part of the program that 



71 



should be treated carefully is the 
generation of the clock. It is important 
to maintain the sampling and reproduc- 
tion clocks as close as possible. Large 
variations produce unpleasant results. 
The program presented here has 
been written for the 6502. Converting 
the code to any other microprocessor 
requires only limited programming 
ability. 

The Use of the Unit 

The unit is very simple to use. A 
cassette or any tape recorder records 
the words of messages to be stored for 
later reproduction. It is good to leave 
pauses before and after each part to aid 
in recognition. When an acceptable 
record has been obtained, especially 
without too much background noise, 
the output of the tape recorder is con- 
nected to the input of the unit, and the 
program is run. 

Some practice is required to start 
the tape recorder and to signal the com- 
puter such that the whole record is 
sampled; this is especially true when 
the record is long and the buffer is 
small. Recall that 2K of memory is 
needed for each second of speech. The 
program permits finding the initial and 
final location of memory used by the 



/ 



Scotch' 

MEMOREX 
\ferbatim. 

maxell, 
BASF 

wabash 



Diskettes and all your media needs 
Our REGULAR prices are SPECIAL 

CALL FREE (800| 421-3957 

C.O.D. charge cards accepted. 
Excellent dealer program. 




1418 West Shaw Avenue 
Fresno, C A 93711 

/„ Cat ca« (2091 22M 118 

Foothill of The Sierras 



Listing 1 (continued) 



15 
■13 18 



1152: 

1152:53 
1155:15 

1158:20 11 IE 

115B;H 1C 59 

115E:53 19 53 

llAi;20 11 IE 

iiAi;ii 

11A7:59 
116A:18 



219 X 

220 DLM 



20 
IE 
15 



53 
51 
53 

11AD;19 53 20 
1170:55 53 19 
1173:iE 17 
1175:0D 



51 19 IE 
55 IF 55 
53 1C 59 
20 56 11 

52 19 11 
12 1C 15 

3 




1C 
15 



20 

IF 

20 

1C 

20 

11 55 

11 51 

IF IE 

OD 

57 19 51 

18 20 51 

18 15 20 

ID IF 51 

IF 52 

1C 11 

ID 13 33 

31 31 37 

20 19 13 

2E 

OD OD 



11 15 
51 11 
ID IF 
55 1C 
19 



IF 
20 



50 
11 
2C 20 



1C 15 
53 15 



15 

IE 51 15 
52 20 12 
17 19 
19 IE 
17 20 11 
11 11 52 
15 53 53 
OD IF 



15 
IE 



OD 

19 53 20 
19 51 
19 IE 
55 51 
IF 52 



20 
50 
20 
20 
51 
51 



IF 



1C 15 
53 15 



20 1C 
53 51 
11 11 
52 15 

53 
IF 



50 1C 

11 53 



2C 20 53 
19 17 IE 

1C 20 

18 

20 

15 11 11 
59 
OD IF 



11 
57 
IE 



15 
52 



ASC 



'SPEECH 



ANALYSIS AND SYNTHESIS USING" 



221 



117A:13 if IE 222 



1179: 

ii7c: 

117Fi 
1182: 

1185: 
1188: 

118E:: 

ii8e: 
ii9i: 
1191: 
1197: 
ii9a: 
ii9d; 
iiAo: 
11A2: 
11A3: 
11A6: 
11A9: 
iiAc: 
iiaf: 

11E2: 

lies; 

11E:8 

iieb; 

IIEIE 

IIBF 

UCl 

11C1 

11C7 

UCA 

IICD 

IIDO 

11D3 

11D6 

11D9 

HOC 

UDF 

llEl 

llEl 

11E2 

11E5 

11E8 

llEB 

llEE 

llFl 

11F1 

11F7 

11F8 

UFA 

UFA 

IIFD 

1200 

1203 

120A 

1209 

120C 

120F 

1212 

1211 

1216 

1-216 

1219 

121C 

121F 

1222 

1225 

1228 

122B 

122E 

122F 

1231 : 

XXX SUCCESSFUL 



DFB 13 

ASC "CONTINUOUSLY VARIABLE SLOPE DELTA 
MODULATION" 



223 



DFB 13 
ASC "WITH 



THE MOTOROLA MC3117 IC . 



226 DLMO 



DFB 13,13 

ASC "PLEASE, ENTER BEGINING ADDRESS" 



228 X 

229 DLMl 
230 



DFB 13,»1F 

DFB 13 
ASC "IS 



IT INPUT OR OUTPUT?" 



231 

232 X 

233 DLM3 



DFB 13,»1F 

ASC "PLEASE, ENTER LAST ADDRESS" 



231 

235 X 

236 DLM2 



DFB 13,«1F 

ASC "PLEASE, SIGNAL WHEN READY" 



237 
238 X 

assembly; 



DFB 13,«1F 
NO ERRORS 



72 



MICRO - The 6502/6809 Journal 



No. 55 - December 19; 



Voice Output Circuit 

+ G 



20 



6522 



PBO 



PB1 



PB2 



PB3 



10 



11 



12 



13 




sample, by changing the initial and 
final locations of the part to be 
reproduced. 

If the message has pauses, it is 
possible to save memory by converting 
the reproduction program into a sub- 
routine, making a call for each one of 
the parts, with appropriate waiting 
loops separating them. If it is better to 
leave the pauses in, clear the tape noise 
by storing hexadecimal 55 in all the 
locations of the pause. Now it is possi- 
ble to see how little noise the process 
itself introduces! 

When the message is to be stored in 
permanent memory and used many 
times, it is advisable to use a good high- 
speed tape recorder and a person with a 
pleasant voice to produce the originals. 
With several messages stored on disk it 
is possible to write a routine that calls 
the proper message into a standard area 
of memory and reproduces it. In this 
way, the same routine can handle 
many messages in an economical way. 

You may contact Mr. Valdez at 1001 
Flotilla, Indian Harbour Beach, FL 32937. 



Perry PeRiphERAls Repairs KIMs!! 

(SYMs ANd AIMS Too) 

• We will Diagnose, Repair, and Completely Test your Single Board Computer 

• We Socket all replaced Integrated Circuits 

• You receive a 30-day Parts and Labor Warranty 

• Your repaired S.B.C. returned via U.P.S. — C.O.D., Cash 

Don't delay! Send us your S.B.C. for repair today 
Ship To: (Preferably via U.P.S.) 

Perry PcRiphcRAls 

6 Brookhaven Drive 
Rocky Point, NY 11778 

KIM-1 RcpUcEiMCNT ModuUs 

• Exact replacement for MOS/Commodore KIM-1 S.B.C. 

• Original KIM-1 firmware — IK and 4K RAM versions 

REpUccMCNT KIM-1 KcyboARds 

• Identical to those on early KIMS — SST switch in top right corner 

• Easily installed in later model KIMs 

Perry Peripherals is an authorized HDE factory service center. 

Perry Peripherals carries a full line of the acclaimed HDE expansion components for you KIM, SYM, and AIM, 
including RAM boards. Disk Systems, and Software like HDE Disk BASIC Vl. 1. Yes, we also have diskettes. For 
more information write to: P.O Box 924, Miller Place, NY 11764, or Phone (516) 744-6462. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



73 



Enhanced Video for OSI CIP 



by David Cantrell and Terry Terrance 



Add a screen blanker, inverse 
upper case, and dim character 
set to your Challenger. 



Enhanced Video 

requires: 

OSI C1P 

hardware modification 



By adding five chips and cutting only 
two traces, you can add several features 
to your CIP video section. There will 
be a trade-off for these features, how- 
ever. To keep the hardware and soft- 
ware as simple as possible, you lose 
lower-case alphanumerics when these 
features are implemented. But, no soft- 
ware support is necessary; no cumber- 
some POKEing and no software drivers 
to scroll a background screen (because 
there isn't any). You simply release 
your SHIFT-LOCK key whenever you 
want to enter modified video. Your 
machine's video will interpret lower- 
case characters as modified video 
whenever this modification is enabled. 
Since the rest of your machine simply 
"sees" lower-case alphanumerics, they 
can be put into strings and then simply 
PRINTed to the screen. The video mod- 
ification can be disabled with either a 
hardware or software switch. 

The circuit keys on Video Data Bit 5 
(VD5) and Video Data Bit 6 (VD61. 
Whenever these bits are high and the 
modification is enabled, VD5 and VD6 
will be masked, turning lower case into 
upper case, and an upper-case character 
in the selected "mode" (i.e., inverse, 
dim, etc.) will be displayed instead of 
the lower-case character. Since charac- 
ters above 128 also have VD5 and/or 
VD6 set, gating is used to restore VD5 
and VD6 and disable the modification 
whenever VD7 is set, retaining your 
graphics characters. 

Before we get into soldering, let's 



discuss OSI's video as implemented on 
the CIP. Even though we've spent the 
past couple of years squinting at our 
ClP's screen almost daily, some of its 
subtleties have escaped us. When the 
screen is filled with CHR$(161) (OSI's 
solid white block character) and is 
viewed from about two feet away, all 
but the poorest TV or video monitor 
will show faint dark vertical lines on 
character cell boundaries. You may 
have attributed these lines to a one-dot- 
wide intercell space. 

Closer inspection reveals that the 
whole screen is filled with evenly 



spaced dots — no blank spaces appear 
between cells. As the rows of dots of 
each character are clocked out of the 
shift register U42, the first dot in each 
row is held only one-third as long as the 
others in that row. Since this happens 
for the first dot of each row and for each 
charac;ter, the end result is faint dark 
bars when viewed from a distance. 

This is the subtle video defect al- 
luded to before. It's so subtle that most 
osiers do not notice it, or pass it off as 
intercell spacing. If C4 users are won- 
dering why this effect can' t be seen, the 
effect is reversed on the C4. The first 



Figure 1: Schematic tor Enhanced Video 



U25-3 ■ 
U41-22- 

U41-19- 
U42-1 
SW4 ■ 

SW3- 
SW2- 

U42-9 - 



10 



U1 



8 2 



U1 




U2 




U2 




U3 




12 



U2 





U1 



-U41-23 



11 



12 



12 



U42-1 11 

U42-7 



D Q 
U4 

C Q 



9 13 



C 
U4 

D Q 



U3 



-.11 




R2 



■ U70-6 



150Q 5KQ 



8 4 



U3 




U3 



8 2 



U42-2 - 
SW1 - 

U42-2 



D Q 

U5 
C 



"O 



-U70-2 



12 



11 



D Q 

U5 
C 



74 



MICRO - The 6502/6809 Journal 



No. 55 - December 198 



dot is accentuated giving rise to bright 
vertical lines. This minor problem 
wouldn't be worth mentioning except 
the timing defect that causes it must be 
fixed if we are to add our modified video. 

Before you begin construction, here 
are a few warnings. Keep all wires as 
short and as direct as possible. You'll 
be dealing with your video signal at RF 
frequencies. You'll want to avoid re- 
radiating your game of invaders all over 
your house and quite possibly to the 
neighbors' too. Do not substitute 
74LSXX series components for 74XX 
series components or vice veisa. This 
circuit is carefully balanced regarding 
timing and current drive capabilities,- 
tampering will probably overheat all of 
the components in the circuit. 

The parts list is'short; you will need 
UI 74LS08 Quad 2-Input And 

Gates 
U2, U3 74LS00 Quad 2-Input Nand 

Gates 
U4, U5 7474 Dual D Flip-Flop 
Rl 150 Ohm resistor 

R2 5K Ohm 

potentiometer 
SW1-SW4 SPST switch 

Since there are five chips in the cir- 
cuit, it cannot be assembled in the pro- 
to area of your CIP. You can assemble 
the circuit on perfboard or solderless 
breadboard using wire- wrap (or any 
technique you prefer). The circuit 
assembles in a straightforward manner. 
In figure 1 the chips numbered U1-U5 
refer to the components of our modifi- 
cation; all other "U" numbers refer to 
chips on your CIP. 

The schematic does not show how 
to wire in SW1-SW4. SW1-SW4 are the 
mode slection switches,- each one 
should connect its associated line to 
ground. We have not found it neces- 
sary, but good circuit design would dic- 
tate that the lines SW1-SW4 should be 
pulled up to -1-5 by 3.3K pull-up 
resistors. Figure 1 does not show sup- 
plying -I-5V and ground to all of the 
chips in the circuit. All the chips used 
have the standard DIP power and 
ground pins. For 14-pin packages, all 
pins 7 should be wired to ground and all 
pins 14 should be supplied with + 5V. 

Once the circuit is assembled, you 
must splice it onto your CIP. Cut the 
trace running from U41 pin 23 to U40 
pin 13, and the trace running from U42 
pin 9 to U70 pin 2. Connect U25 pin 3 
to Ul pin 1. Connect U41 pin 22 to Ul 
pin 9 and U41 pin 19 to U2 pin 2. Con- 
nect Ul pin 6 to U41 pin 23. 



We'll stop for a moment and ex- 
plain what this part of the circuit does. 
U25 pin 3 is VD5 and U41 pin 22 is 
VD6, the data bits that the circuit keys 
on to know whether to output modified 
video. U41 pin 19 is VD7. Three gates 
of Ul and two gates of U2 perform logic 
to accomplish the following functions. 
If VD5 and VD6 are high and SW2 is 
high and VD7 is low, Ul pin 6 is low 
causing lower-case characters to be 
read as upper case and activating the 
rest of the circuit via U2 pins 9 and 10. 
If either VD6 or VD5 is low or SW2 is 
low, Ul pin 6 will be high and the 
screen will behave normally. 

Continuing with conections, U42 
pin 9 is brought into U3 pin 12. U42 
pin 1 is brought into U4 pin 11; U42 
pin 7 is brought into U3 pin 5. Connect 
U42 pin 2 to U5 pin 3 and coimect U42 
pin 2 to U5 pin 8. Signals coming out of 
the circuit on U5 pin 5 must be con- 
nected to U70 pin 2. The output of the 
potentiometer R2 should be brought to 
U70 pin 6. 

This is where our circuit starts 
modifying video. If the first part of the 
circuit has recognized a modified video 
situation (i.e., VD5 VD6 VD7 SW2), 
then U2 pin 8 goes high. The signal is 
now fed to parts of U2 and U3 where, 
combined with the states of switches 
SW3 and SW4, the inverse and dim op- 
tions are selected. If dim is selected, 
either alone or in combination with in- 
verse, the signal on U2 pin 1 1 is used to 
enable the flip-flop U4, which is clocked 
at the shift-load rate (i.e., CLK/8) and 
through the R1-R2 network modulates 
the video for a dimming effect. R2 con- 
trols the level of brightness from 
almost fully bright to almost dark. SW3 
controls the inverse option. If it is low, 
the normal video signal is passed from 
U42 pin 9 out to U5 pin 5 without in- 
version (but with latching as we will 
see in a moment). When SW3 is high, 
the shift- load clock (from U42 pin 1) 
and the inverse shift register output are 
combined by sections of U4 and U3 to 
produce inverse video. The section of 
U5 that immediately follows fixes the 
video defect we mentioned earlier. In- 
stead of the dots being cut off by the 
video chain clock, it is now latched for 
the whole period of the system clock 
and, therefore, maintains full bright- 
ness. This part of the circuit operates 
regardless of whether any modified 
video options are selected. 

We haven't forgotten SWl and the 
other half of U5. They combine, along 



with your system's clock, to produce 
the blank screen option mentioned 
earlier. When SWl is high, your screen 
will not show any display. Video 
memory will still be updated, however, 
so that whenever SWl is brought low 
the whole screen will be restored. This 
could be handy to do screen set-ups, 
hide your game moves in a two-player 
game, etc. 

Table 1 offers a recap on the opera- 
tion of switches SW1-SW4. 

Table 1 

SWITCH* MODE 

12 3 4 

H X X X BLANK SCREEN 
L L X X NORMAL SCREEN 
L H L L UPPER CASE ONLY 
L H H L INVERSE UPPER CASE 
L H L H DIM UPPER CASE 
L H H H DIM INVERSE UPPER 
CASE 

H = High, L = Low, X = Don't care 

To test the modification, be sure all 
of the mode selection switches (SWl- 
SW4) are in the low state; this will en- 
sure that you will have a normal screen 
to look at while you're setting up. 
We'll write a little program to fill the 
screen with mixed upper- and lower- 
case characters like the one below: 

10 F0RX=1T012 

20 PRINP'AaBbCcDdEeFfGgHhliJj" 

30 NEXT 

This should fill your screen with alter- 
nating upper- and lower-case letters. 

Using the mode selection switches, 
select inverse upper case; according to 
table 1 this should be L H H L. With the 
switches thus set, all lower-case letters 
should now be displayed as inverse up- 
per case. Step through all the other 
modes to ascertain that they are work- 
ing properly. If not, carefully check 
your wiring of both the circuit board 
and its interconnections to your CIP. 



You may contact the authors at Orion 
Software Assocs., 147 Main St., P.O. Box 
310, Ossining, NY 10562. 



iMOK) 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



AARDVARK 
TRS-80 COLOR OSI VIC-64 VIC-20 SINCLAIR TIMEX 




QUEST - A NEW IDEA IN ADVENTURE 
GAMES! Different from all the others. 
Quest is played on a computer generated 
map of Alesia. Your job is to gather men 
and supplies by combat, bargaining, explor- 
ation of ruins and temples and outright 
banditry. When your force is strong enough, 
you attack the Citadel of Moorlock in a 
life or death battle to the finish. Playable 
in 2 to 5 hours, this one is different every 
time. 16k TRS-80, TRS-80 Color, and Sin- 
clair. 13K VIC-20. $14.95 each. 




AOVENTURESM! 

These Adventures are written in BASIC, are 
full featured, fast action, full plotted ad- 
ventures that take 30-50 hours to play. (Ad- 
ventures are interactive fantasies. It's like 
reading a book except that you are the main 
character as you give the computer com- 
mands like "Look in the Coffin" and 
"Light the torch.") 

Adventures require 16k on TRS80, TRS80 
color, and Sinclair. They require 8k on OSI 
and 13k on Vic-20. Derelict takes 12k on 
OSI. $14.95 each. 

ALSO FROM AARDVARK - This 
TRS-80 Color and OSI ), business 



CATERPILLAR 

O.K., the Caterpillar does look a lot like a 
Centipede. We have spiders, falling fleas, 
monsters traipsing across the screen, poison 
mushrooms, and a lot of other familiar 
stuff. COLOR 80 requires 16k and Joy- 
sticks. This is Edson's best game to date. 
$19.95 for TRS 80 COLOR. 

PROGRAMMERS! 

SEE YOUR PROGRAM IN THIS SPACE!! 

Aardvark traditionally pays the highest com- 
missions in the industry and gives programs 
the widest possible coverage. Quality is the 
keyword. If your program is good and you 
want it presented by the best, send it to 
Aardvark. 

ESCAPE FROM MARS 

(by Rodger Olsen) 
This ADVENTURE takes place on the RED 
PLANET. You'll have to explore a Martian 
city and deal with possibly hostile aliens to 
survive this one. A good first adventure. 

PYRAMID (by Rodger Olsen) 
This is our most challenging ADVENTURE. 
It is a treasure hunt in a pyramid full of 
problems. Exciting and tough! 

HAUNTED HOUSE (by Bob Anderson) 
It's a real adventure— with ghosts and ghouls 
and goblins and treasures and problems — 
but it is for kids. Designed for the 8 to 12 
year old population and those who haven't 
tried Adventure before and want to start 
out real easy. 

DERELICT 
(by Rodger Olsen & Bob Anderson) 
New winner in the toughest adventure from 
Aardvark sweepstakes. This one takes place 
on an alien ship that has been deserted for a 
thousand years — and is still dangerous! 




TUBE FRENZY 

(by Dave Edson) 
This is an almost indescribably fast action 
arcade game. It has fast action, an all new 
concept in play, simple rules, and 63 levels 
of difficulty. All machine code, requires 
Joysticks. Another great game by Dave 
Edson. TRS 80 COLOR ONLY, 16k and 
Joysticks required. $19.95. 




CATCH 'EM 

(by Dave Edson) 
One of our simplest, fastest, funnest, all 
machine code arcade games. Raindrops and 
an incredibe variety of other things come 
falling down on your head. Use the Joy- 
sticks to Catch'em. It's a BALL! — and a 
flying saucer! — and a Flying Yl— and so 
on. TRS 80 COLOR. $19.95. 

BASIC THAT ZOOOMMS!! 
AT LAST AN AFFORDABLE COMPILER! 

The compiler allows you to write youi 
programs in easy BASIC and then auto- 
matically generates a machine code equiv- 
alent that runs 50 to 150 times faster. 
It does have some limitations. It takes a' 
least 8k of RAM to run the compiler and i 
does only support a subset of B.ASIC- 
about 20 commands including FOR, NEXT 
END,GOSUB,GOTO, IF,THEN, RETURN 
END, PRINT, STOP, USR (X), PEEK 
POKE, *, /, -I-, -, > , < ,=, VARIABLE 
NAMES A-Z, SUBSCRIPTED VARIABLES 
and INTEGER NUMBERS FORM 0-64K. 
TINY COMPILER is written in BASIC. I 
generates native, relocatable 6502 or 680! 
code. It comes with a 20-page manual am 
can be modified or augmented by the usei 
$24.95 on tape or disk for OSI, TRS-8 
Color, or VIC. 



Please specify system on all orders 
is only a partial list of what we carry. We have a lot of other games (particularly for the 
programs, blank tapes and disks and hardware. Send $1 .00 for our complete catalog. 



W^ 



AARDVARK - 80 

2352 S. Commerce, Walled Lake, Ml 48088 

(313)669-3110 

Phone Orders Accepted 8:00 a.m. to 4:00p.m. EST. Mon.-Fri. 



4| 



76 



MICRO - The 6502/6809 Journal 



No. 55 - December 1! 



Home Control Interface 

forCIP 



by John Krout 



A circuit is presented that uses 
the CIP's ACIA to control an 
ultrasonic transducer. The 
transducer generates signals 
that control the receiver 
modules. 



BSR X-10 DRIVER 

requires: 

0SIC1P 

BSR X-10 

hardware modifications 



Perhaps the greatest untapped potential 
of personal computers is control of 
common household devices such as 
lamps, air conditioners, and TV sets. A 
computer that turns an air conditioner 
off after you leave for work and on 
before you return will rapidly pay for 
itself in energy savings; and one that 
handles lights and entertainment 
equipment on a schedule will dis- 
courage burglars who prefer to enter 
unoccupied homes. You can probably 
think of more uses. 

BSR markets the X-10 Control 
System through the mail and in Sears 
and Radio Shack stores. This remark- 
able system consists of a central com- 
mand console about the size of a 3" x 5" 
file box, and up to 16 control modules, 
each the size of a pack of cigarettes. An 
appliance is plugged into a control 
module, which in turn is plugged into a 
power outlet. A control dial on each 
control module allows the user to set a 
unique unit code, ranging from 1 to 16, 
for that module. The user may control 
the module remotely via the console by 
pushing a button to specify the unit 
code. Another button turns the selected 
control module on or off. 

A second form of control module in- 
cludes a dimming control for lamps, 



and a third form replaces a wall switch. 
Each control module is a radio receiver, 
which accepts transmitted commands 
only after receiving its own unit code. 
The command console is the trans- 
mitter, utilizing home power lines as 
an anterma. 

Ohio Scientific was probably the 
first computer manufacturer to 
recognize the value of interfacing the 
X-10 command console to a personal 
computer. OSI now offers a hardware 
interface and a disk operating system to 
support the X-10. However, OSI 
charges a premium price for these 
items, and offers nothing to those using 
BASIC-in-ROM. 

An optional feature of the command 
console provides the key to a simple 
and inexpensive interface to a com- 
puter. BSR also developed an ultrasonic 
hand-held command unit and combined 
the console with an ultrasonic receiver. 
This allows wireless control at a dis- 
tance (like the ultrasonic hand- held TV 
controller) . If you know the ultrasonic 



code used by BSR, a few hardware mod- 
ifications in your CIP will allow com- 
puter generation of the same codes, 
through an ultrasonic transducer, to 
transmit to the command console. 

Figure 1 shows the various com- 
ponents of a single word of BSR code. 
The code is binary, with each bit 
represented by an 8-ms pattern of 
sound. A bit with value 1 is sent as 4 
ms of tone followed by 4 ms of silence. 
A bit with value is sent as 1.2 ms of 
tone followed by 6.8 ms of silence. The 
data word begins with a 1 bit, followed 
by five bits of data, followed by five in- 
verted bits of the same data, and com- 
pleted with 16 ms of tone and 24 ms of 
silence. The tone itself is 40 KHz. The 
five-bit code for each control module 
and function is shown in table 1 . 

A single latched output bit in the 
computer is all you need to transmit 
the code. The CIP uses latched output 
bits to scan the keyboard and joysticks 
as well as drive a digital-to-analog con- 
verter [D/A] circuit. However, BASIC 



Figure 1 






1 




EACH 8 ms BIT 


LOGIC 1 


OR 


LOGIC 

1 

f 








V 




1 










COMPRISES 


1 




1 








4 ms TONE 




1.2 


msTC 


3NE 


















+ 4 


msSIL 


ENCE 




^ 


6.8 


rn 


5 SILENCE 








1 
— LOGIC 1 


— 1 


1 1 

1 






1 


1 
1 




MESSAGE 
















HEADER 




1 — FIVE BINARY 














CODE BITS 


L FIVE INVEF 


ITED 










CODE BITS 






— 16 ms 


1 — 24 ms 








TONE 










SILENCE 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



77 



Figure 2 




Table 2 



IC1 PIN 14: +5V 
IC1 PIN 7: ground 



Table 1 












Unit Code 




Binary Code 


i 


1 





1 


1 








2 




1 


1 








3 








1 








4 







1 








5 
















6 















7 





1 










8 




1 










9 




1 


1 







10 




1 


1 







11 








1 







12 







1 







13 

















14 
















15 




1 











16 




1 











Function Code 


Binary Code 


17/AlI Units Off 













18/ All Lights 


On 








1 




19/On 








1 





1 


20 /Off 








1 


1 




21/Dim 





1 










22/Bright 





1 





1 





continually scans the keyboard |unless 
the Control-C break is disabled by an 
appropriate POKE) so some sort of tone 
is almost always being produced on the 
D/A output while BASIC, or any other 
keyboard-oriented program, is being 
used. This makes using the D/A un- 
pleasant for music composition and 
playback. 

A less well-known bit of latched out- 
put exists in the CIP. This is the RTS 
(Request- To-Send) line associated with 



the 6850 Asynchronous Serial Com- 
munications Interface chip (ACIA) used 
in the CIP to exchange data with a cas- 
sette machine, modem, or printer. This 
particular line is not used by the CIP, 
although the ACIA designers provide it 
so that a computer can indicate whether 
or not it is ready to receive data. 

The control register of the ACIA 
chip controls the status of the RTS line, 
among other ACIA activities. In 
BASIC, whenever the Break key is de- 
pressed, the control register is reset to a 
value of 17 and RTS goes low. If you 
POKE a value of 64 to the register, then 
RTS will go high and stay there until 
another value is stored in the register. 
One advantage of this bit in the BSR in- 
terface is that it will automatically turn 
off when Break is depressed. The ACIA 
control register is located in the CIP at 



Item 


Value 


ICl 


4001 CMOS quad NOR gate 




14-pin DIP 


Rl 


2.2K resistor 


R2 


2.2K resistor 


R3 


2.2K resistor 


R4 


12K resistor 


R5 


50K trim potentiometer 


R6 


330K resistor 


CI 


330 pF capacitor 


Ql 


Sylvania ECG123A transistor 




or equivalent 


UT 


40 KHz ultrasonic transducer i 



address 61440 1$F000). 

The RTS line can be toggled at a 
40-KHz rate to produce the BSR code. 
Since the CIP uses a standard clock 
rate of 1 MHz, the wavelength of a 
40-KHz tone is precisely 25 clock 
cycles . However, I found by timing my 
CIP with an oscilloscope that its clock 
is running about 4% slow. Thus, I 
could produce the tone using a 24-clock 
cycle wavelength. Instead, I chose to 
build a free-running 40-KHz oscillator 
and use the RTS line to switch the 
oscillator output to an ultrasonic 
transducer. 

The oscillator circuit is shown in 
figure 2, and the parts are listed in table 
2. The only part not universally avail- 
able is the ultrasonic transducer, a 
capaCLtive loudspeaker that creates the 
actual tone. Since these devices are 



Listing 1 








i 


10 
20 
30 


; ASSEMBLY 


LISTING 


OF BSR X-10 DRIVER ROUTINE 1 


: BY JOHN KROUT 




40 










50 




*=»0222 




60 




DELAY=4FC91 




70 










SO 


START 


JSR 


»AE05 ; 


puts arguement in *AE,AF 


90 




LDX 


»AF 




100 




LDA 


TABLE-1 


X 


110 




STA 


«AF ; 


lookup !?-: stare cade word 


120 




LDA 


#5 




1 3.0 




STA 


»15 




140 


MASTER 


JSR 


WORD 




150 




DEC 


«15 ; 


counts data words sent 


160 




BNE 


MASTER 




170 




RTS 


; 


return to Bssic 


1 BO 










190 










200 


WORD 


JSR 


LOGICl 


• send message header bit 


210 




LDA 


*AF 


; command cade into accumulator 


220 




JSR 


SEND 


send top 5 accumulator bits 


230 




LDA 


*AF 


; reload accumulator 

(continued) 



78 



MICRO - The 6502/6809 Journal 



No. 55 - December 198^ 



Listing 1 (continued) 



270 
230 
290 



LDOPl 



;io 



370 loop: 

3S0 
390 
4CjO 
410 ; 



EQR 
J SB: 
LDA 
STA 
LDX 
STX 
JSR 
DEC 
BNE 
LDA 
STA 
LDX 
STX 
JSR 
DEC 
BNE 
J MP 



#255 
BEND 
#64 

$F(;)00 
#4 

«16 

MS4 

»16 

LQDPl 

#17 

*F000 

#5 

«16 

MS4 

*16 

L0OP2 

MS4 



430 
440 
450 
460 
470 
430 
490 



3END 



ROLL 



2ERQ 
:OUNT 



540 LOGIC 1 



5S0 
590 
600 ; 

61.0 LOG I CO 

630 
640 



630 MS4 

690 LQ0P3 

700 

710 

720 

730 ; 

740 MSI. 2 

750 L0QP4 



790 MS6.8 

800 LOOPS 

810 

820 

830 

840 ; 

S50 TABLE 

860 

870 



invert accumulator bits 
send 5 inverted bits 



begin 16 ms tone 



begin 24 ms silence 



STA *13 
LDA #5 
STA *14 
ROL *13 
BCC ZERO 
JSR LQ6IC1 
JMP COUNT 
JSR LOG I CO 
DEC *i4 
BNE ROLL 
RTS 

LDA #64 

STA *F000 

JSR MS4 

LDA #17 

STA SFOOO 

JMP MS4 

LDA #64 
STA *F000 
JSR MS 1.2 
LDA #17 
STA $F000 
JMP MS6.B 

LDX #15 

DEX 

BNE L00P3 

LDX #3 

JMP DELAY 

LDX #228 

DEX 

BNE LQQP4 

RTS 

LDX #52 

DEX 

BNE L00P5 

LDX #5 

JMP DELAY 



.BYTE 76,224,32, 160, 16, 144,80,208 
. BYTE 112, 240,48, 176, 0, 128, 64, 192 
.BYTE 8,24,40,56,72,33 



counter for bits s 
pi see bit in Cs,rr; 
branch, if Carry = 
send 1 og i c 1 

send logic 

branch until 5 bit 



beg if! 4 ms tone 



begin 4 ms silence 



begin 1.2 ms tone 



begin 6.8 ms silence 



Listing 2 



Listing 3 



FC9 1 


A0F8 


LDY 


#*Fe 


FC93 


83 


DEY 




FC94 


DOFD 


BNE 


*FC93 


FC96 


55FF 


EQR 


*FF, X 


FC9S 


CA 


DEX 




FC99 


D0F"6 


BNE 


SFC71 


FC9B 


60 


RTS 





1 00 
110 
120 
130 
140 
1 50 
1 60 
170 
1 80 
190 



START 



*=*0222 


LDX 


#64 


STX 


«F0OO 


NOP 




LDX 


#178 


DEX 




BNE 


XI 


STX 


SFOOO 


LDX 


*3 


LDX 


#198 


DEX 




BNE 


X2 


JMP 


START 



pretuned to a specific frequency, be 
sure the one you buy is set to 40 KHz. 
One transducer that costs less than $10 
is #J4-815 in the Calectro catalog. 

The circuit can be installed on any 
of the unconjiected prototype sockets 
adjacent to the ACIA, with a pair of 
output lines running out of the com- 
puter case to the transducer. Or the cir- 
cuit can be placed externally on perf- 
board, with connection lines for power, 
ground, and RTS. Because my CIP 
board is crowded with add-ons, I chose 
the latter method. I recommend that 
you do not rn;ount the transducer to the 
CIP case because it has to be in a fairly 
direct line with the receiver micro- 
phone grid on the front face of the com- 
mand console for transmission to be 
reliable. To preserve aiming flexibility, 
put the transducer on a lengthy flexible 
signal cable. You can secure it to the 
command console grid, if you wish. 

A USR software-driver routine for 
the interface appears in listing 1. This 
routine begins by calling the ROM 
BASIC subroutine at address $AE05, 
which deciphers the argument value 
within the parentheses following the 
USR call in BASIC text, and puts that 
value in locations $AE and $AF in the 
form of a 15-bit integer with a sign bit. 
Any argument value outside the range 
of -32768 to +31767 will cause a 
function call error if the $AE05 routine 
is called. 

The USR routine assumes that the 
argument is a number between 1 and 
22, corresponding to a BSR unit or com- 
mand number. Lines 90 through 1 10 
look up the appropriate five-bit com- 
mand code in a data table and replace 
the original argument value with the 
code. Lines 120 through 160 produce 
five repetitions of code transmission, a 
factor which was found reliable when 
used in a BASIC program that turned 
house lights on and off over a two-hour 
period. This means that each USR call 
takes about 640 ms. 

The main subroutine WORD begins 
at line 200 with transmission of the 
single-bit prefix, a logic 1. Then the 
command code is loaded and trans- 
mitted once, reloaded, inverted in line 
240, and transmitted again. The code- 
word suffix .is sent by the remainder of 
WORD. 

Subroutine SEND analyzes each bit 
of the five-bit command code and trans- 
mits the appropriate tone sequence. In 
line 450, ROL $13 places each com- 
mand bit into the Carry bit of the 6502 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



79 



status register and, in line 460, BCC 
branches if the Carry bit is zero. 

Subroutine LOGIC 1 turns on the 
RTS line, waits 4 ms, turns off the RTS 
line, and waits another 4 ms. LOGICO 
waits 1.2 ms after turning on RTS and 
then waits 6.8 ms after turning off RTS. 

The three timing subroutines MS4, 
MSI. 2, and MS6.8 handle the precise 
waiting periods required by the other 
subroutines. Each includes a DEX/BNE 
loop that takes five clock cycles per 
iteration, except that only four are used 
when BNE does not branch. The prior 
LDX immediate in each case takes two 
cycles, as does the following LDX im- 
mediate in MS4 and MS6.8. These two 
routines then use three cycles to fMP to 
a routine called DELAY in the monitor 
R0Mat$FC9L 

Delay is a time-delay loop that, 
perhaps, was included in ROM to aid in 
disk I/O. It appears in listing 2 and uses 
1250 cycles per iteration, with the 
number of repetitions controlled by the 
6502 X register. The RTS at the end 
takes an extra six cycles. The difficulty 
with DELAY is that it wipes out not 
only the X and Y registers but also the 



Listing 4 



40 
45 



SO 
85 
90 



PR I 

PR: I 

PR I 

PP'I 

PR I 

PR I 

INP 

n4 

Ml = 

M6= 

D=l 

04= 

Rl = 

D6= 

PQK 

PCK 

POK 



NT' 
NT 
NT' 

M"r 
NT' 
NT" 
■UT 
INT 
INT 
INT 

INT 
INT 
INT 

'^ /-, 

:e6S 

;E69 



Enter yot.:r CIP clocV 
rate a.5 a decinia.I f r 
t i on c-f the standarc 
fnag-ahertiT cicck rate 

(e?>; ampl e: fcV. -f ai;t i = 
entered as 1-06) "5 
E! 

(4000*Q) -12 

<1200*Q)-7 

(6800*Q) -12 

(M4/Di :R4=INT ( (M4-D 

(Ml/5) 

(M6/D) :R6=INT( kM6 

5,R4:PaKE680,D4 

5,D1 

R6:PaKE696,D6 



'4*D! , 
:6*D) . 



Listing 5 



5 X=546: Z=60000 
7 SAVE 

9 PR I NT: PR I NT 

10 FQRI=0T0175 I 
20 IFI=INT (1/15) »15THENPRINT: I 

PFINTZ; "DATA"; : 2=Z+5:SaT030 \ 
25 PRINT", "; | 

30 A»=STR*{PEEK(I+X) ) : PRINTR IGHlj 

«(A«,LEN(A«)-1) ; ! 

40 NEXT 1 

50 PRINT ! 

60 PRrNT"20 POKE 11, 34 .-POKE 12, 2 
70 PRINT"30 FaRI=0Tar75:READA: 

POKE I +546, A: NEXT" 
80 PRINT"40 NEW" 
90 PR I NT " R0KE5 1 5 , : RUN " 
95 POKES 17,0 



Listing 6 

60000 

60i;i05 

600 1 

600 1 5 

6(j020 

60025 

60030 

60035 

60040 

60045 

60O50 

60055 

20 POKE 

30 FORI 

40 NEW. 

PQKE515 



DATA32,5, 174, 1 66, 1 75, 189, 187 , 2, 133, 1 75, 1 69, 5, 1 33, 21 , 32 
DATA56,2, 198, 21,208,249,96, 32, 130, 2, 165, 175,32, 106,2 
DATA 165, 173,73,255,32, 106, 2, 169,64,, 141 , 0,240, 162, 4, 134 
DATA22,32, 162,2, 198, 22,208,249, 169, 17, 141 , 0, 240, 162,3 
DATA134,22,32, 162, 2, 198,22,203,249,, 76, 162,2, 133, 19, 169 
DATA5, 133,20,38, 19, 144,6,32, 130,2,76, 125,2,32, 146 
DATA2, 198,20, 203,239, 96, 1 69, 64, 1 41 , 0,240,32, 162, 2, 169 
DATA17, 141 ,0,240, 74, 162,2, 169, 64, 141,0, 240, 32, 172, 2 
DATA169, 17, 141, 0,240, 76, 178, 2, 162, 15,202,208,253, 162, 3 
DATA76, 145, 252, 162, 228, 202, 208,253,96, 162, 52, 202,208, 253, Ic 
DATA5,76, 145,252,96,224,32, 160, 16, 144,80,203, 112,240, 48 
DATAl 76,0, 128,64, 192,8, 24, 40,56, 72,88 
1 1,34:P0KE12,2 
=0T0175:READA: PaKEI+546, A:NEXT 

, : RUN 




Plus Sensational Limited-Time Savings 
On Ohio Scientific C1P Series personal 
computers, Superboard and C1P 
accessories, spare replacement parts, 
printers, monitors, integrated circuits, 
and other computer-related components. 

To Order 

Call us directly or return order coupon with 
your checl<, money order, or Mastercard or 
Visa Account Number, Orders will normally be 
shipped within 48 hours after receipt. 
$100.00 minimum order, 

FREE 

Sampler Cassettes with each Superboard II and 
C1P series order! 

Taxi (Game), Electronic Equations, Loan Finance, Straight 
and (Constant Depreciation, Uneven Cash Flows 

Tiger Tank, Flip Flop, (Logic Game), Hectic, Black Jack, 
Master Mind 



Super Sale! 



60% ■ ^^** 

AQWOif On Ohio Scientific Superboard II 
A Complete Computer System On A Board 

Includes full-size 53-key keyboard, video and audio cassette 
interfaces; SWAP, Modem, sampler cassettes; manual; 8K 
BASIC-in-ROM, with 8K RAM. Requires 5-V/3 amp regulated 
DC power supply. 30-day limited warranty. Supply is limited. 
ONL Y . $200.00 - NOW! $149,951! 



mm Cleveland Consumer Computers & Components 

[■■■ 1333 S. Chillicolhe Road, Aurora, OH 44202 
TO ORDER: CALL 1-800-321-5805 TOLL FREE 
(Ohio Residents Call 216-562-4136) 

S1')S.95 
D SUPERBOARD ll,.$20©:ee— 

D Send Detailed Catalog/Order Form 

Name 




Address . 



State_ 



City 

Payment by enclosed check or money order or charge to: 
D MasterCard O VISA 

Account # ExpiriJtion Date 

Total Amount Charged or Enclosed $ 



.Zip_„ 



Ohio Residents Add 5.5% Sales Tax. All Orders Will Be Shipped Insured By UPS Unless 
Requested Otherwise. 



80 



IVIICRO - The 6502/6809 Journal 



No. 55 - December 198; 



Listing 7 



5 60102001:1 



REM ... LITESHOW CONTROL PROGRAM 
REM ... F-QR BSR X-10 INTERFACE .. 
REM ... BY JOHN KROUT 



140 
199 



REM SPOTS: 1 ON, 1 OFF 

1 : 

F0RA=1T03: B=A-H : IFA=3THENB=1 
Y=USR{B) : I FPEEK (Q) =EGOTO 1 000 
:::i Y=USR ( A) : I FPEEK (Q) =EG0T01000 
NEXT: BOTOl 10 



240 

7C3 



REM SPOTS: 2 ON, 1 OFF 
F0RA=1T03 

Y=usR(is) : ifpeek:(ci)=egdtoiooo: rem all spots 

Y = USR ( A ) : Y=USR ( 20 ) : I FPEEK' ( Q ) =EGOTO 1 000 : REM : 
F0R:[ = 1T01000: NEXT: REM TIME DELAY 
NEXT: G0TG210 



ON 
OFF 



: PR I NT: PR I NT" projector; 



300 REM KEYBOARD CONTROL 

302 G0SUB4000: PRINT" SPOTS " : PR I NT: PR INT"STROBES " 

304 P0KE6 , 39 : PCKEG+2 ,, 66 : POKEG+4 , 82 

311J PnKE530, 1:P0KE570SS, 127: P=P£EK ( 570SS ) !P0KE530,0 

315 IFPEEK (Q) =EG0T01000 

320 F0RA=1T07: IFS (A, 1 ) =PSOT0335 

325 NEXT:G0Ta310 

335 Y=USR ( ft ) : I FS ( A , ) =OTHENY=L!SR U 9 ) : S ( A , ) = 1 : POKES ( A , 2 ) , 43 : G0T03 1 

340 Y=USR (20) : S (A, 0) =0: POKES (A, 2) ,32: GDT0310 

^ C3 O 



400 F 
40 1. 
410 F 


<EM STROBES: 1 ON, 1 OFF 


-0RA=4TC6: B=A+1 : IFA=6THENB=4 


420 


-•=USR (B) : Y=USR ( 19) : IFPEEK (Q ) =EGOTa 1000 


430 Y=USR (A> : Y=USR (20) : IFPEEK (Q! =E60T01000 


440 f 


JEXT: GaT'a410 


499 




1000 


REM MAIN MENU 


1020 


F0RI=1TC7: S (I , 0) =0: NEXT:REM STATUS RESET 


1025 


G0SUB4000 


1030 


PR I NT "MAIN MENU : " : PR I NT 


1040 


PRINT"1. SPOTS: 1 ON, 1 OFF" : PR I NT: PRINT 


1042 


PRINT"2. SPOTS: 2 ON, 1 OFF ": PR I NT: PRINT 


1044 


PR I NT " 3 . K:EYBCARD CONTROL " : PR I NT : PR I NT 


1046 


PRINT"4. STROBES: 1 ON, 1 OFF ": PRINT 5 PRINT 


1 1 iJO 


INPUT "function number" ; F: PR I NT 


1 1 1 


I FF ■: 1 ORF :■ 1 OORF :> I NT ( F ) SOTO 1 1 00 


1113 


Y=UER(17): REM SHUTDOWN 


1 1 20 


ONFGOTO 1 00 , 200 , 300 , 400 


i 20"'.! 


END 


2000 


REM IN IT 


2010 


DIMS(7,2) 


2020 


S(l, 1)=127 


2030 


B ( 2 , 1 ) = 1 9 1 


2040 


S(3, 1)=223 


2 01 50 


S (4, 1 ) =239 


2060 


S(5, 1 ) =247 


2070 


5(6, 1 >=251 


20S0 


3(7, 1)=253 


2100 


0=57100: E=222 


2110 


G=53901 


2120 


S( 1,2) =6+64 


2 1 30 


S (2, 2) =6+66 


2140 


S (3, 2) =6+68 


2 1 50 


S(4,2)=6+12S 


2160 


3(5,2) =6+130 


2170 


S(6,2)=6+132 


21 BO 


E(7,2) =G+194 


2999 


GOTO 1000 


40i:h;i 


REM SCREEN CLR SUB 


4010 


FOR I =1T02S: PR INT: NEXT: RETURN 



non-permanent basis. Alternatives in- 
clude stack storage and replacing 
DELAY with your own non-destructive 
time delay. 

Because my CIP runs about 4% 
slow, the time delays in MS4, MS6.8, 
MS 1.2, and the message suffix portion 
of WORD have been shortened about 
4% to compensate. If you can obtain an 
oscilloscope, listing 3 will load and ex- 
ecute a useful infinite loop USR rou- 
tine. This routine turns on RTS for 
precisely 999 cycles, and then turns off 
RTS for 1001 cycles, giving an overall 
wavelength of exactly 2 ms for a 
machine running at exactly 1 .MHz. If 
your machine is running a few percent 
slow or fast, listing 4 will compute and 
POKE the necessary loop constant al- 
terations to the BSR X-10 driver 
routine. 

As with many USR routines, it is 
convenient to place the driver in un- 
used memory below BASIC text, start- 
ing at $0222. Because the OSI Assem- 
bler occupies this space and cannot 
directly assemble the routine there, a 
loader in B.i\SIC is useful. Listing 6 
uses the familiar method of POKEing 
numbers from DATA statements to 
memory, and is itself a product of 
listing 5, a BASIC program generator. 
Listing 5 includes the very advan- 
tageous features of placing two 
immediate-mode commands at the end 
of listing 6: a POKE to terminate 
LOAD, and RUN. Since the DATA 
statements are so long in this case, the 
NEW statemient in line 40 of listing 6 
erases listing 6 after its work is done, 
leaving behind the driver routine and 
the data in locations 11 and 12 that tell 
BASIC where the USR routine begins. 

Listing 7 is a BASIC light show con- 
trol program, which is loaded after 
listing 6 has finished. The program pre- 
sumes that X-10 lamp modules 1,2, and 
3 control colored spotlights, that appli- 
ance module.s 4, 5, and 6 control colored 
strobe lights, and that appliance module 
7 controls the lamp of a slide projector. 
Projector lamps usually exceed 300 
watts. You should keep the projector fan 
running even when the lamp is off to 
cool the lamp and avoid a blowout. 

Would you like some automation in 
your life? Perhaps you need a timer for 
your toaster, or a security system for 
your office copier. Computer in- 
telligence plus BSR X-10 versatility can 
do it for you. 



accumulator. The latter could have 
been avoided by using a few NOPs in- 
stead of the EOR. In the USR routine, 
whenever a delay routine is called, this 
problem forces storage in memory of 
the command word, the number of 



words sent, and the number of bits 
sent. Since BASIC does not use the in- 
put buffer beginning at $13 for anything 
other than input, USR can access that 
space with compact and speedy page 
zero addressing for data storage on a 



The author may be contacted at 5108 N. 
23rd Rd., Arlington, VA 22207. 



iMCftO 



No, 55 - December 1982 



MICRO - The 6502/6809 Journal 



ATARI Meets the BSR X- 1 



by David A. Hayes 



A circuit is presented to 
interface thie ultrasonic version 
of the BSR X-10 home control 
system to Atari computers. 
Programming information and a 
sample program are included. 



Demo Program 

requires: 

Atari 400/800 
BSR X-10 



To use the BSR X-10 home control 
device, many computers require a hard- 
ware modification. David Staehlin 
presented a circuit, in the January 1982 
issue of BYTE magazine, which will 
couple a non-ultrasonic BSR X-10 to an 
RS-232 port. I have interfaced the 
Atari' s controller jack port to the more 
common ultrasonic version of the BSR 
X-10. Figure 1 shows the complete in- 
terface circuit required for this purpose. 
Modification of the BSR X-10 is not 
trivial and should be performed by 
competent technicians only. 

The program in listing 1 loads a 
machine-language program into page 6 
of memory. Line 100 sets up controller 
jack 1, pin 1, as output. Table 1 lists 
the code that the BSR X-10 understands. 
The machine-language program sends 
this code out controller jack 1, pin 1, 
whenever it is called by the USR routine. 

For example, if you have made the ap- 
propriate hardware modifications, have 
typed in the program in listing 1, and 
now want to turn all lights on, line 110 
of your program should look like this: 



110 X = USR(1536,0,0,0,128,128, 
128,128,128,0,0) 

Now turn on channel five. 



120 X = USR(1536,0,0,0,128,0,128, 

128,128,0,128);REM SELECT 
CHANNEL 5 

130 X = USR(1536,0,0,128,0,128,128, 
128,0,128,0):REM TURN ON 



The author may be contacted at 2004 
Woody Drive, Kingston, TN 37763. 



(Continued on next page) 



Table 1 


■ ■- ■ ■■ 


FUNCTION 


X = USR(1536,A,B,C,D,E,F,G,H,I,r) 


ALL LIGHTS ON 


0,0,0,128,128,128,128,128,0,0 


ALL OFF 


0,0,0,0,128,128,128,128,128,0 


ON 


0,0,128,0,128,128,128,0,128,0 


OFF 


0,0,128,128,128,128,128,0,0,0 


BRIGHTEN 


0,128,0,128,128,128,0,128,0,0 


DIM 


0,128,0,0,128,128,0,128,128,0 


CHANNEL 




1 


0,128,128,0,0,128,0,0,128,128 


2 


128,128,128,0,0,0,0,0,128,128 


3 


0,0, 128,0,0, 128, 128,0, 128, 128 


4 


128,0,128,0,0,0,128,0,128,128 


5 


0,0,0,128,0,128,128,128,0,128 


6 


128,0,0,128,0,0,128,128,0,128 


7 


0,128,0,128,0,128,0,128,0,128 


8 


128,128,0,128,0,0,0,128,0,128 


9 


0,128,128,128,0,128,0,0,0,128 


10 


128,128,128,128,0,0,0,0,0,128 


11 


0,0,128,128,0,128,128,0,0,128 


12 


128,0,128,128,0,0,128,0,0,128 


13 


0,0,0,0,0,128,128,128,128,128 


14 


128,0,0,0,0,0,128,128,128,128 


15 


0,128,0,0,0,128,0,128,128,128 


16 


128,128,0,0,0,0,0,128,128,128 



Figure 1 




1N4148 



GREEN WIRE 
O GOING TO 
KEYBOARD 



0.001 M F 



82 



MICRO - The 6502/6809 Journal 



No. 55 - December 198 



Listing 1 

10 FOR RDD=1536 TO 1756: REfiD INST: POKE HDD, INST: HEKT HDD 
20 DhTh 1 04 , 32 , 1 33 ,6,1 04 , 1 04 ,48 , 6 , 32 , 169,6 , 76,17,6 , 32 , 1 33 , 6 , 

1 04 , 1 04 ,43 , 6 , 32 , 1 63 
25 DflTfl 6,76,30,6,32,133,6,104,104 
30 DFlTFl 43 , 6 , 32 , 1 63 , 6 , 76 , 43,6 , 32 , 1 33 ,6,1 04 , 1 04 , 43 , 6 , 32 , 1 69 , 

6,76 , 56 , 6 , 32 , 1 33 , 6 
35 DflTfl 104,104,43,6,32,169,6,76,69 
40 DflTfl 6 , 32 , 1 33 ,6,104,1 04 , 43 , 6 , 32 ,169,6,76 , 32 , 6 , 32 , 1 33 , 6 , 

1 04 , 1 04 , 43 , 6 , 32 ,169 
45 DflTfl 6,76,95,6,32,133,6,104,104 
50 DflTfl 43 , 6 , 32 , 1 69 ,6,76,1 03 , 6 , 32 , 1 3S , 6 , 1 04 , 1 04 , 43 , 6 , 32 , 

169,6,76,121,6, 32 , 1 33 
55 DflTfl 6,104,104,43,6,32,169,6,76 
60 DflTfl 1 34 , 6 , 32 , 1 33 , 6 , 32 , 260 , 6 , 96 , 1 63 , 254 ,141,0,211,162 , 

1 20 , 1 60 , 10,1 36 , 203 
65 DflTfl 253 , 202 , 20S , 243 , 1 69 , 255 ,141,0,211,162 
70 DflTfl 1 20 , 1 60 , 10,1 36 , 20S , 253 , 202 , 203 , 243 , ^G . 1 €.3 , 254 ,141 , 

,211,162, 40 , 1 60 , 1 
75 DflTfl 136, 203 , 253 , 202 ,208,243,1 69 , 255 ,141 
80 DflTfl 0,211,162,31,1 60 , 70 , 1 36 , 208 , 253 , 202 , 203 , 248 , 96 , 1 63 , 

254,141,0,211,162 
85 DflTfl 54,160,70,136,203,253,202,208,243 
90 DflTfl 169,255,141,0,211,96 
100 POKE 54013,56: POKE 54016,1: POKE 54018,60: POKE 54016,1 



miCftO 



/"OHIO SCIENTIFIC "^ 



HEVi PROGRAMS! 

SCOUT- Full color, machine 
language, fast action and 
graphics! After a year of 
development, comes the all 
machine language SCOUT. 
Patrol the planet surface pro- 
tecting and saving the human 
population from abductors. 
Turn your OSI into a real ar- 
cade! 
$24.95 C4PMF, C8PDF. 

Send for our FREE catalog. 
We have what you want for 
less: S-FORTH $39, FULL 
SCREEN EDITOR $19, 
ADVENTURE $19, SKYHAWK 
$8, TOUGH TYPING $19, IN- 
TELLIGENT TERMINAL $24, 
THE V\/IZARD'S CITY $12, 
UTILITIEES, and much more for 
the 01 P to the 08PDF. 

(312)259-3150 
AURORA SOFTWARE 

pBT! 37 S. Mitchell 
Arlington Heights 
feB^ Illinois 60005 




OSI Disk Users 



Double your disk storage capacity 
Without adding disk drives 

Now you can more than double your usable floppy disk 
storage capacity — for a fraction of the cost of additional 
disk drives. Modular Systems'DiskDoublerT** is adouble- 
density adapter that doubles the storage capacity of 
each disk track. The DiskDoubler plugs directly into an 
OSI disk interface board. No changes to hardware or 
software are required. 

The DiskDoubler increases total disk space under OS- 
65U to 550K; under OS-65D to 473K for 8-inch floppies, 
to 163K for mini-floppies. With the DiskDoubler, each 
drive does the work of two. You can have more and 
larger programs, related files, and disk utilities on 
the same disk — for easier operation without constant 
disk changes. 

Your OSI system is an investment in computing power. 
Get the full value from the disk hardware and software 
that you already own. Just write to us, and we'U send you 
the full story on the DiskDoubler, along with the rest 
of our growing family of products for OSI disk systems. 

™DiskDoubler is a trademark of Modular Systems. 

Post Off ice Box 16 C 
Oradell, NJ 07649.0016 
Telephone 201 262.0093 



Modular Systems 



APPLE II PERIPHERAL DEVELOPERS: 

Your complex function prototype requires 
llie best wirewrap board avallablii. 

SPECTRUM SYSTEMS MAKES IT! 



Fully Extended WIrewrap Protoboard. 

Size: 2.S by 10.7 incli 2 layer PC. 
Capacity: up to 58-16 pin or12-40 pin 

or any combination socl(ets inbetween. 

Carefully designed +5 and GND planes provide lor 
the minimum electrical noise, low impedance, tii 
capacitance, and maximum versatility in the layout 
of IC's, capacitors, discretes and I/O connectors. 

Wire-wrap technique documentation included. 

Terms: 

• $45.00 + (6% Cal. Res. tax) + J2.00 SiH. 

• All payments must be in U.S. iunds drawn on a U.S. 
bank. 

• Outside U.S. add 10%. 

• Cashier check/money order allow 30 day ARO. 

• Personal checks add 2 weeks. 

• No credit cards or cash. Please! 

Spectrum Systems 

PO. Box 2262 

Santa Barbara, Ca. 93120 

AoplE II ii a Irademark of Apple Compuieri 




No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



83 




The 68000 

DREAM MACHINE 



WE (SORT OF) LIED: 

Motorola has been promoting its advanced microprocessor 
chip as a vehicle for large, complex systems exclusively. 
Now, the 68000 does work well as the heart of big, complex 
systems. But their promotional literature implies that one 
can only build big, complex systems with the 68000, and that 
is dead wrong (in our opinion). Nevertheless, the public 
(that's you!) perception of the 68000 follows Motorola's line: 
Big systems. Complex systems. 

Our boards are not complex and not necessarily big (starting 
at 4K), Our newsletter is subtitled "The Journal of Simple 
68000 Systems." But since the public has become condi- 
tioned to the 68000 as a vehicle for FORTRAN, UNIX, LISP, 
PASCAL and SMALLTALK people naturally expect all these 
with our $595 (starting price) simple attached processor. 
Wrong I 

We wrote our last ad to understate the software we have 
available because we wanted to get rid of all those guys who 
want to run (multi-user, multi-tasking) UNIX on their Apple II 
and two floppy disks. Running UNIX using two 143K floppies 
is, well, atisurd. The utilities alone require more than 5 
megabytes of hard disk. 

HERE'S THE TRUTH: 

We do have some very useful 68000 utility programs. One of 
these will provide, in conjunction with a suitable BASIC com- 
piler such as PETSPEED (Pet/CBM) or TASC (Apple II), a five 
to twelve times speedup of your BASIC program. If you have 
read a serious compiler review, you will have learned that 
compilers cannot speed up floating point operations 
(especially transcendentals). Our board, and the utility soft- 
ware we provide, does speed up those operations. 

Add this line in front of an Applesoft program: 

5 PRINT CHR$(4);"BLOADUTIL4,A$8600":SYS38383 

That's all it takes to link our board into Applesoft (assuming 
you have Applesoft loaded into a 16K RAM card). Now run 
your program as is for faster number-crunching or compile it 
to add the benefit of faster "interpretation". Operation with 
the Pet/CBM is similar. 

68000 SOURCE CODE: 

For Apple II users only, we provide a nearly full disk of un- 
protected 68000 source code. To use it you will have to have 
DOS toolkit ($75) and ASSEM68K ($95), both available from 
third parties. Here's what you get: 

1) 68000 source code for our Microsoft compatible floating 
point package, including LOG, EXP, SQR, SIN, COS, TAN, 
ATN along with the basic four functions. The code is set up to 
work either linked into BASIC or with our developmental 
HALGOL language. 85 sectors. 



9^ f 



H 



2) 88000 source code for the PROM monitor. 35 sectors. 

3) 68000 source code for a very high speed interactive 3-D 
graphics demo. 1 15 sectors. 

4) 68000 source code for the HALGOL threaded interpreter. 
Works with the 68000 floating point package. 56 sectors. 

5) 6502 source code for the utilities to link into the BASIC 
floating point routines and utility and debug code to link into 
the 68000 PROM monitor. 113 sectors. 

The above routines almost fill a standard Apple DOS 3.3 flop- 
py. We provide a second disk (very nearly filled) with various 
utility and demonstration programs. 

SWIFTUS MAXIMUS: 

Our last advertisement implied that we sold 8MHz boards to 
hackers and 12.5MH2 boards to businesses. That was sort of 
true because when that ad was written the 12.5MHz 68000 
was a very expensive part (list $332 ea). Motorola has now 
dropped the price to $1 1 1 and we have adjusted our prices ac- 
cordingly. So now even hackers can afford a 12.5MHz 68000 
board. With, we remind you, absolutely zero wait states. 

'Swiftus maximus'? Do you know of any other 
microprocessor based product that can do a 32 bit add in 0.48 
microseconds? 

AN EDUCATIONAL BOARD? 

If you want to learn how to program the 68000 at the 
assembly language level there is no better way than to have 
one disk full of demonstration programs and another disk full 
of machine readable (and user-modifiable) 68000 source 
code. 

Those other 'educational boards' have 4MH2 clock signals 
(even the one promoted as having a 6MHz CPU, honest!) so 
we'll call them slow learners. They do not come with any 
significant amount of demo or utility software. And they com- 
municate with the host computer via RS 232, 9600 baud max. 
That's IK byte/sec. Our board communicates over a parallel 
port with hardware AND software handshake, at 71 K 
bytes/sec! We'll call those other boards handicapped 
learners. 

Our board is definitely not for everyone. But some people find 
it very, very useful. Which group do you fit into? 

DIGITAL ACOUSTICS 

1415 E. McFadden, Ste. F 

Santa Ana, CA 92705 

(714) 835-4884 



Apple, Applesoft and Apple M are trademarks of Apple Computer Company. Pet is a trademark of Commodore Busines:; Machines. ■ 



84 



MICRO - The 6502/6809 Journal 



No. 55 - December 19 



68000 Logic Instructions 



by Joe Hootman 



This is the third in a series of articles 
on programming the 68000. Piofessoi 
Hootman is presenting the instruction 
set of the 68000 microprocessor and 
will then consider the addressing 
modes and how they apply to the 
various instructions. This month's 
topic is the logical instructions. 



The logic instructions implemented 
in the 68000 are given in table 1 . These 
instructions are the AND, the OR, the 
NOT, and the EOR. The implementa- 
tion of the logical operations is 
straightforward. The logic operations 
affect the CCR depending on the results 
of the operation. It should be noted that 
the logical operations do not operate on 
the address registers directly. 

The logic operations on the status 
register are privileged. Logical opera- 
tions on the user condition code 
register are not privileged. 



Joe Hootman can be contacted at the 
University of North Dakota, Department 
of Electrical Engineering, University 
Station, Grand Forks, North Dakota 

58202. 



Table 1: Logic Instructions 



Mnemonic 


Dau Size/CCR 


Name 


Comments 








AND 


8, 16, 32 

CCR 

XNZVC 


togical 
AMU 


The source and destiBation are logically ANDed 
and the result stored in the destination. 
Opword Format 




-..00 




15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 




1 


1 





Register 


Op Mode Effective Address 
Mode 1 Register 




Register — Any of the eight data registers. 








Op Mode field 
Byte Word Long word 

A) 000 ■■ 001 010 Data register ANDed 
with the EA and 
result left in the data 








register. 








B|100 




101 110 EA ANDed with the 
data register and 
result left in the EA. 



For case A of the Op Modes the following 
effective addressing modes cannot he used: % 13, 
14.* For case B of the Op Modes the following 
effective addressing modes cannot he used: 1, 2, 
10, 11, 12, 13, 14.* 



AND! 



8, 16, 32 


CCR 


XNZVC 


- « .. 



AND 
Immediate 



The immediate data and the destination are 
logically ANDed and the result stored in the 
destination. 

Opword Format 

15 14 13 12 U 10 9 8 7 6 5 4 3 2 1 


















Q 


1 





Size 


Effective Address 
Mode 1 Register 


Word data (16 bits 
including the first 
8 bits! 


Byte data (8 bits) 


long data |32 bits including the previous bits) 



Size field 

00 - Byte 

01 - Word 

• 10 - Long word 

ThefoDowing addressing modes cannot be used: 
2, 10, II, 12, 13, 14.* 



AND! 8 • AM> lie immediate data is ANDed with the CCR and 

to CCR CCR , • . . Hmnediate the results stored in the CCR. The state of the 

XNZVC , to, Con4ition, CCR after the operation depends on the previous 

* ,-'♦ . . . , Code, ' data in the CCR and the immediate data 

Register in the operation. 

Opword Format 
. ■ ■" '' ' 15 14 13 121110 987 '6 543210 


















71 


1 








7 


1 


I 


1 


1 

















,0 


ll 








[^ 


Byte Data 



(continued) 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



85 



Table 1 (continued) 
Mnemonic Data Size/CCR Name 



Comments 



EOR 



8, 16, 32 
CCR 

XNZVC 
-..00 



Exclusive 

OR 

Logical 



Tbe source and the destinatioii are exclusively 
ORed together and the result stored iathe 
destination. (Data registers only for source data.J 

Opword Format 
15 14 13 12 11 10 9 8 7 6 5 4 3 110 



Register 



Op Mode 



Effective Address 
Mode I Register 



Register field — Any one of the eight data 
registers can be specified. 

Op Mode field 

100 - Byte . 

101 - Word 

110 - Long word 

The effective address specifies the destination of 
the result of the operation and the following 
addressing modes cannot be used- 2, 10, 11, 12, 
13, 14.* 



EORI 



8, 16, 32 


Exclusive 


CCR 


OR 


XNZVC 


Immediate 


-••00 





. The immediate data and the destination data is 
exclusively ORed together and the result 
stored in the destination. 

Opword Formal 

15 14 13 12 11 10 ? 8 7 6 5 4 3 2 1 

Size I Effuctivu Addicss | 



Word data (16 bitsj 



Mode I Regiiiter ! 



Byte data (8 bits) i 



Long data (32 bits) I 



Size field 
00 - Byte The data is in the lower order 

byte of the mimediate word. ' 

■ 01 - Word Thedata is the entire 

immediate word. 
10 - Long word The data is contained m the 
next two immediate words. 

The effective address specifies the destination of 
the result of the operation and the toUowing 
addressing modes cannot be used' 2, 10, 11, 12, 
13,. 14.* 



EORI 


8 


Exclusive 


to CCR 


CCR 


OR 




XNZVC 


Immediate 






to 

Condition 
Code 
Register 



The immediate data is exclusively ORed with the 
CCR and the result stored in the CCR. 

Opword Format 
15 14 13 12 11 10 9 8 7 6 5 4 .? 2 1 















1 





1 





1 1 1 1 1 


























Byte natd 



NOT 



8, 16, 32 
CCR 

XNZVC 
-..00 



Logical The onts complement ot the destination is 

Complement taken and the results stored m tlie 
destination. 



Opwoid t-ormat 
15 14 13 1211 10 9 8 7 6 j 
iToTo 

_.LL 



9 8 

— T— 
1| 



, .. Size 

Ll _. 



5 4 3 2 10 

Effective Address i 
Mode I Register 



Size field 

00 - Bvtc 

01 - Word 

10 - Lung word 

The effective address specilies the destination 
and the following addressing modes cannot he 
used: 2, 10, 11, 12, 13, 14.' 

(continued/ 



MICRObitS (continued) 



VisiCalc To Apple Plot 

Interface translates from VisiCalc to 
Apple Plot, prevents erroneous 
graphs, fits curves to data, and 
supplements VisiCalc with rank 
ordering and alphabetizing. Send 
SASE for details or $30.00 for the 
copyable program. 

Bill Starbuck 

2100 E. Edgewood 

Sho.Tewood, WI 53211 

|414) 963-9750 



VisiCalc To Apple Writer 

Veecee-Writer translated VisiCalc 
(/PFj files for Apple Writer 1. Send 
$15.00 for the copyable program. 

Bill Starbuck 

2100 E. Edgewood 

Shorewood, WI 53211 

[4141 963-9750 



TRS-80 Color Computer 

Expand your 4K system to 16K for 
$29.95. Expand 4K or 16K to a 32K 
system for only $99. Obtain better 
coloi graphics. Full instruction/ 
documentation provided in each kit. 
Two- to three-week delivery time. $3 
postage /handling charge. 

Dick Williams 

Computer Shed 

Lane 2-1 

Derry, NH 03038 

(603) 432-3634 



Unique VIC-20 User Group 

Borrow any program from our 
extensive loan library for only 10% of 
cost and get free newsletter and 
special purchase prices on all VlC-20 
hardware and software from our huge 
catalog. Membership only $25 by 
check, VISA, MasterCard. 

Software To Go 

Rt. 3, Box 309 A 52 

Clinton, TN 37716 

(615) 457-5068 

(615) 584-0022 



18000 Software 

For Apple-compatible boards 
(DTACK). The Moose: professional 
and only available 68000 chess 
program — $67. MUXA68: UCSD 
68000 Crossassembler — $70. 
68TICID: Debugger — $47. PCON68: 
UCSD-Interface for DTACK board — 
$30. $10 shipping and handling. 

Moose Systems / 

Steenbargkoppel 21 

D-2000 Hamburg 65 

Germany 



(Continued) 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Table 1 (continued) 

Mnemonic Data Size/CCR 



Function 



Comments 



OR 



8, 16, 32 
CCR 

XNZVC 
-..00 



Inclusive 

OR 

Logical 



ORI 



8, 16, 32 


Inclusive 


CCR 


OR 


XNZVC 


Immediate 


-..00 





ORI 

to 

CCR 



8 


Inclusive 


CCR 


OR 


XNZVC 


Immediate 




data to 




Condition 




Code 




Register 



The inclusive OR operation perfoims the OR 
operation on the soiuce data and the 
destination data. The result is left in the 
destination. 



Opword Format 
15 14 13 12 1110 9 8 7 6 5 4 3 2 1 



Register Op 



Modi: Effective Address 
Mode I Register 



Registti iiild ipccifici .inv of the 8 data registers 

Op Mci'.c l.el.l 
000. Bvtc 
001 • Word 
010 ■ 1 uiig wiird 

The result is .stured in the specified dat.i register 
The efiective address specifies the source and the 
fotlowiri); addre<;sing modes cannot be uicd 2, 

13, 14.' 

Op Made ticld 

100 • Byie 

101 ■ Word 

110 ■ Li-'n;; word 

The resui t is stored in the effective adchcss and 
the following addressing modes cannnt be used' 

1, 2, 13, 14 • 



The immediate data is inclusive ORed with the 
data in the destination and the result is left 
in the destination. 

Opword Format 
15 14 13 12 11 in 9 8 7 6 5 4 3 2 1 ( 
Size 



Word data 1 16 hits) 



Eftecuve Address 
Mode I Register 



Byte data [& bitsi 



Long data (32 bits) 



Size field 
00 - Byte 



The data is the lower byte ol 

the data word. 
01 - Word The data is the entue 16 bits 

of the data word 
10 - Long word The data is the two immediate 

words 

The effective address is the destination and the 
following addressing modes cannot be used. 2. 
10, 11, 12, 13, 14 * 



The immediate data is inclusive ORed with 
the CCR and the result left in the CCR 

Opword Format 
15 14 13 12 11 10 y 8 7 6 5 4 3 2 1 




o"| ofr[T[ iiT 



0,01 



Byte Data |8 bus! 



'The addressing modes will be covered m future issues. 



MIOIO" 



MICRObitS (continued) 

OSI Peter Packer 

Pack widgits into boxes and ship 
them out in the elevators before your 
defective robot assistant unpacks 
them or packs you! An original arcade 
game of cunning and skill that 
increases in difficulty each round. 8K 
tape $14.95. 

Watts Ware 

153 Madrona Drive 

Anacortes, WA 98221 



OSI - Affordable DBMgr 

8" single/du.al floppy under OS65D 
V3.3 video. User-defined files with 
formatted screen viewing and 
inputting. Features: find, update, 
delete, paging, coding, and 'screen,' 
'quick,' and format' dump. $55.00. 
Label print option — $25.00. Report 
Generator (January 1983), manual 
only — $10.00. 

Bunin &. Ward Computer Services 
P.O. Box 895 Church Street Sta. 
New York, NY 10008 
(212) 434-5760 



Low-Cost Software 

Unique programs and hardware kits 
to adapt small computers to the real 
world. Control machines, make 
music, build test equipment and 
security systems, etc. For 
information, write to us describing 
your system and interests. Include 
stamped self-addressed envelope. 

S.W. Associates 

45 Furman Drive 

Wayne, NJ 07470 



OSI Super Defender 

Play this great arcade game at home. 
All machine code includes: scanner, 
smart bombs, laser fire, moving 
mountains, and more. Save your 
humanoids from the alien landers. 
Very smooth (half-character moves) 
graphics. $14.95 for CI, 2, 4 tape or 
514" disk. 

DMP Systems 

319 Hampton Blvd. 

Rochester, N.Y. 14612 



Dynamite PET/CBM Accessories! 

Write-protect switches/indicators for 
2040/4040 disk drives. Real world 
software at low cost. 2114 RAM 
adapter (replaces obsolete 6550's) and 
4K memory expansion for "old" 8K 
PETs. Hundreds of satisfied 
customers. Write for free catalog! 

Optimized Data Systems 

Dept. M, Box 595 

Placentia, CA 92670 

iSMCftO 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



87 



Programmable Character 
Generator for OSI 



by Colin Macau ley 



Design your own character set 
and save the characters in a 
form suitable for incorporation 
into an EPROIVI. 



Character Generator 

requires: 

OSI Superboard 

While developing software for a mini- 
mum chip homebrew 6502 system, it 
was necessary to produce a character 
generator. I wrote the program for an 
8K OSI Superboard U to draw characters 
on the OSI video and save these charac- 
ters in RAM. The characters could then 
be incorporated in an EPROM, or trans- 
ferred to the homebrew system. The 
program was made fairly general, as the 
homebrew computer included the capa- 
bility of a variable character depth, 
whereas the OSI is restricted to 8 x 8 
characters. Although the program was 
intended for a specific purpose, it is 
equally useful in developing alternate 
character generators for an OSI. Thus, 
if games are a major attraction you may 
wish to define new characters (e.g., 
Space Invader aliens) for unused char- 
acters in your OSI character set. Ac- 
cordingly, the new character set may 
then be loaded into a 2K EPROM (2716) 
and replace the original OSI character- 
generator ROM. 

The MEMORY SIZE? cold start 
prompt should be restricted to 6000. 
This will prevent overwriting the 
character-generator RAM that com- 
mences at $1800 (6144 decimal), allow- 
ing the number of characters to be 256 
with a character depth of 8. The re- 
quired character number is input and a 
display will appear on the screen to 
assist in the graphing of the intended 
character. A cursor in the top left-hand 
corner indicates the bit cunently being 
altered. 



The key commands available for 
manipulating the cursor are as follows: 



The indicated bit is set and the 
cursor is shifted. A block char- 
acter will be inserted at the 
former cursor position. 

The indicated bit is cleared and 
the cursor is shifted. A blank 
character will be inserted at the 
former cursor position. 

The cursor will move from its 
present position to its home po- 
sition (i.e., top left-hand comer 
of display). 

The cursor will move down a 
row of the display. 

The cursor will be shifted to the 
next bit without modifying the 
status of the previous bit. 

"ESC" Return to BASIC. 

"CR" Enter displayed character into 
"character-generator" RAM at 
nominated position. 

■■ -■ e.--- *' ^- 



"1" 

"0" 
"H" 
"D" 



"R" A prompt for the number of a 
predefined character will be re- 
quested. This character will 
then be displayed and may be 
modified to form the basis of a 
new character. 

Set bits will be indicated by a block 
and cleared bits will be blanked to 
allow for an enlarged graphical repre- 
sentation of the character being 
created. The cursor will be either a " 1" 
or a "0" to enable the condition of that 
bit to be readily identified. The 2K 
character generator may be saved on 
cassette, using well-known machine 
code save programs, or used directly by 
an EPROM programmer. 



Colin Macauley is a member of the firm of 
Callinan and Associates, Patent Attorneys 
and a physicist. He uses a modified OSI 
Superboard II and is interested in utility- 
type pr(3gramming. He may be contacted 
at 39 Shoalhaven St., Werribee, Victoria 
3030, Australia. 










■i CHARACTER NO 2 

! ,."■'>...' . '.>' . 
_M.-. ' . ,»; ; .- ;!-'"-■ ■>}, ' 

The figure 1nustriitastiMr''6t''ffei» pragiam fn constructing a "car" 
acter. The "1" cursor fndfcates that this bit has been set. 



char- 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Listing 1: Programmable Character Generator 

4 RErt LOA.U iJ'iR l-'QIjriNE 

'i r;i;i5lje3'5i3 

l« F0RX=UOV,2:PRI«I:r(EXI?, 

2<} PR[i>IT"PROGRArtHflBLE CHARACTER GENER.UOR" :PR [NT 

30 PRINT"COPYRICHT l<ii)1 COLIM rtflCAllLEY" : PRIN f 

48 INPUT"NO. OF CHARACTERS, IH GROUPS OF 16":A 

51 IF(A/l4)-INT(A/14)<>30RA>2'JaTHEma 

55 P0KE11,la2:P0KEI2,T 

61 PR:(NT:]NPUT"CHARACrER flEPTH. I TO 14":6 

7D IFB:;I6THEN43 

3fl PR,[NT::[NPUT"MEU CHARACTER SET (Y/N)":A« 

?« IFniB«(A«,1.l)<:;"'f"THEHI13 

?5 REH BLANK CHAR. GEN. RAH 

liJ0 F0RX = 6I44T0819I :P0KE:x,32:NEXT.< 

118 C=o143 

123 PRINT:INPUT"CHARACTER N0.":0 

138 IFu:-ATHENI23 

135 REil SET UP SCREEN 

143 i30SUB(i8H 

213 REM USR ROUTINE SAVES REGJSTERS i GETS CHAR. FROH KETBH 

228 I = IJSR(Z):H = « 

233 U = PEEI<'.216) 

2,35 REM CHECK IJHICH KEY PRESSED 

23A REd "8" KEY? 

243 IFU048THEN263 

245 [l=32:G0SUB4a3:G0TO22e 

25» REH "1" KEY'? 

26t IFU049THEN273 

2(i5 Q=1ol :G0SUB433:G0T0223 

248 REti "H" KEY'? 

273 IFU072THEN283 

274 P0KEV,UC:Y=S3448:UC=PEEK(Y):L=l:U:=Y:E = 4ij 

275 IFUC = U1THENE=49 

2,^4 POKEY. E:Y=53415:GGT0223 
278 REH "D" KEY' 
280 IFU<>(i8THEN2?3 
285 G0SUB5e3:G0TG22a 
238 RErt "F" KEY' 
293 IFU<>7erHEN3e3 
2'?5 u=OC:fiOSUEi43e:GOT0228 
2'?B REH "tSC" KEY? 
333 IFIJ = 2'THENEND 
385 REH "CR" KEY'' 
313 IFUOI3THEN323 
315 GOSUB7e'J:GOT0138 
318 REh "R" KEY'' 
323 IFIJ = 82THENG0SUB933 
333 G0T0223 

3 43 REH LOAD USR SUBR. 

353 X=A74:F0RY=3T015:READA:P0KEX+Y.A:NEXTY 
368 DAT A72, 138, 72, 152.72,32,134,255.133,216,184,168,134, 
173,134,96 

373 RETURN 

398 REH SUBR. FDR KEYS "3,1 OR F" 

395 REh SHIFTS CURSOR S SETS Oft RESETS [NDICATED BTTS 

438 X=Y + (L*32) + 8:F = U + 1:JFP;XTHENi'i = L+l 

418 P0KEU,Q:rFH>.eTHEN483 

423 1FH>3ANDM<>LTHEN44« 

433 V=P:G0T0453 

443 V = Y+l + (H:t32):L = h 

453 UC=PEEK(V):E=48 

4,i3 .1FUC=I61THENE^49 

478 G0r0498 

483 UC = FEEKiV):E = 48:lFUC = U10RUC-4?THENE = 4? 

485 IFUC=48THENUC=32 

493 POKEV,E:RETURN 

495 REH SUBR. FUR "D" KEY-SHJFTS CURSOR BOUN A LINE 

583 L=L+l:IFL>BTHENL=L-1:R0T0j4a 

518 P0KEV.UC:U=U + 32:LIC = REEKiV):E=48 

523 IFUC=l61THENE-49 

538 POKEU.E 

548 RETURN 

593 SUBR. FOR DRAUING UORKSHEET FOR CHAR. 

683 F0RX=1T0j2:PRINT:NEXTX 

413 X=53415:F=48 

o2« F0RZ=1TQ8:P0KEX+Z.F+I:NEXTZ 

643 F0ft2=1T0B:U^Z:]FU>9THENU=!J-l3 

645 P0KEX+(32*2),48+U:NEXTZ 

653 Y = 5,3448:UC = PEEK(Y):L=I :V = Y:E^48 

663 IFUC=16irHENE=49 



Listing 1 (continued) 


673 POKEY. E:Y=Y-33 


683 rt$ = "COhHAND''" 


4B5 PRINTCHR*(i:3l" CHARACfER N0.":»; 


693 FORX = 1T08:POKE54353 + X,ASC(fHIi$!A$.X.1.i):NEXTX:RErUPN 


495 RE(i SUBR. FOR "CR" KEY 


693 REH SAVES CHAR. IN "CHAR. GEN." RAH AT CORRECT POSITION 


788 POKEU.UC 


718 :=Y 


723 F0RX=1TOB 


738 F = Z + (32^tX):G = 3 


743 F0RH=1T03 


753 I=PEEK(F + H):J = 3:TFI = 161THEKJ--1 


768 G^=G+,J:IFH=8THEN733 


773 G=2*G 


783 NEXTH 


793 paKEC + (':X-1)*A) + D,G 


833 NEXTX 


835 PRINT 


318 INPUT"NEXT CHARACTER N0.";D 


823 RETURN 


383 REH SUBR. FOR "R" KEY -DRAUS REQUIRED CHAR. ON SCREEN 


933 PRINT: INPUT"NO. OF CHARACTER TO BE REi;IEUED";K 


913 IFK>ATHEN983 


923 G03UBa83:Z=Y 


933 F0RX=1T0B 


•943 F = C+!iX-1)^tA)+K:I=PEEK(F) 


953 FQRH^MT03:R=INTi2tiH-l ) + .5) :N=1 2a./R 


960 J=INT(I/N) 


973 IFJ=lTHENP0KE(Z+(At32)+H).161:I^IN 


988 NEXTH:NEXTX 


993 UC^PEEK!Y+33) :L=1 :V=Y+33 


1333 E = 48:IFUC = 161THENE = 4<» 


1813 POKEV,E 


1315 IFUC=43THENUC=32 


1323 RETURN iMCftO 



CSE means OSI 

Software and Hardware 
Specializing in C1P and C4P macliines 



Basic Load/SAVE: 
Employs token loader system. 50-100% faster 

than the old indirect ASCII system. Maintains a 

listing of file names found on the tape 

C1P $10.95 

C4P $19.95* 

Basic Enhancer: 

Renumber, Auto Sequencer, Screen Control func- 
tions, and tape I/O system that is faster and has file 
names 

C1P $21.95 

C4P $29.95* 

*comes with required modified monitor Rom chip 



NEW! NEW! NEW! 

ANCHOR SIGNALMAN MODEMS 



.$95.00 



Please write for more info on new disk programs or 
send $2.00 for catalog. Please include $2.00 shipping 
($4.00 for modems). 

Computer 

Science 

Engineering 

Box 50 • 291 Huntington Ave. Boston 02115 




No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



89 



dan't have t#'W«ry agoirt <rFele¥ant ^ :- 
material w^icfl hasTvcirtmrest foryou, : ;: 
because there are three specific volumes. 
One for the Apple* one for the; IBM-PCr 
Undone for the TRS-80r 
In each of these books author Ed Faulk 
leads you through your favorite com- 
puter and takes the mystery out of writing 
programs for it. As you proceed, interest- 
ing chapter by interesting chapter, you'll 

•Apple is a trademark of Apple Computer. Inc.lBM-PC is a trademark 
VISAMASTERCHARGE accepted S2.00 shipping-handling charge. 



^lii+ty want HOW TO WRITE A PRO- 
: ORAM. Before you're past Chapter 2 
rydu'ii be programming. By the end of the 
book you'll be willing to tackle business 
programs, personal use programs and 
even games and adventures! $14.95 
Get your copy now. Available at computer 
and book stores, or: 



\i (213)709-1202 
9748 Cozycroft Ave., Chatsworth, CA 9131 1 

k of IBM Corp.-TRS-80 is a trademark of Tandy Corp 




Reston Publishing Comp 
A Prentice-Hall Company 
Reston, Virginia 
Toll free (800) 336-0338 



/AlCftO 

Updates 
and Microbes 



updates 

John Beckett of CoUegedale, TN, 
sent in this revision to "A Homespun 
32K Color Computer" (53:91). 

Solder the chips together rather 
than expecting hand-bent pins to make 
good contact. It is best to put a ferrite 
bead around the wire connected to the 
6883 chip, just before it reaches the 
6883. Failing this, use a 33-ohm re- 
sistor. This is done in Tandy's 32K ver- 
sion and is recommended by Motorola 
in their 6883 data sheet. Later models 
of the PC board have a place on the PC 
board where you may connect the lead 
from the extra bunk of chips, that 
avoids soldering directly to the 6883. 



Myron Pulier, M.D., from Teaneck, 
Nf, sent in this update: 

The LISZT program in the May, 
1982 issue of MICRO (48:37) makes 
readable BASIC listings. The authors 
used a disk zap utility program to get 
lower-case characters in the DATA 
statements. Lacking such, I used the 
temporary patch, shown in listing 1, 
appended to LISZTER. 

This patch creates new DATA 
strings after converting all alphabetic 
characters to lower case except the first 
one in each string. These new strings 
are read into a TEXT file named "DF". 
When this file is EXECed it replaces the 
LISZTER DATA statements with the 
new ones and displays the result for 
confirmation. The patch itself is 
removed so the converted program may 
be SAVEd. 

To operate the zap bypass program, 
LOAD LISZTER, type in the enclosed 
statements, and save the combined pro- 
gram as "TEMP" in case something 
goes wrong. Then type "RUN 1000". If 
the run is successful, save the program 
now in memory as your new copy of 
LISZTER. 



(Continued on page 98) 



leee ««««««««««««««« zop byposs for liszt 



1 ees D« 



Chr»(4) 



1010 



1015 
1020 



1025 



1030 



1035 



1040 



1045 

1050 

1055 

1060 

aeee 

£005 

£010 

£015 
£0£0 
£0£5 
£030 

£035 

£040 



QT» = Chr»(16£) 

BR» = QT» + ", ■' 

Print D»"OPENDF" 

Print D»"DELETEDF" 

Print D»"OPENDF" 

Print D»"WRITEDF" 

Print "SOVELISZTER. PATCH 

Print ay'DOTO"; 

fi = 1 

B = £5 

Gosub £005 

Print ea"DOTO"i 

fi = £6 

B = 50 

Gosub £005 

Print a9"DfiT0"; 

= 51 

B = 51 

Gosub £005 

Print 90"DfiTfi"; 

= 5£ 

B = 75 

Gosub £005 

Print gr'DOTfi"; 

fi = 76 

B = 107 

Bosub £005 

"DEL 1000,3040" 

' INVERSE: ?"QT»"DfiTfi CDN'VERTED" 

"NORMfiL:SPEED=iaa:LiSl 67-91 :SP£ED=£:55 

D*"CLDSE" 

D»"EXEC DF" 



Print 
Pr i nt 
Print 
Print 
Print 
End 



♦•♦♦•♦••♦•••««« 

For J = fi To B 
Read ST» 
Print QT»; 
LF = 
L = Len(ST*) 
If L Then 

Gosub 3005 
If J = B Then 
Print QT$ 
If J < B Then 
Print BR»; 
Next 
Return 



CONVERT ONE LINE 



3eee *************** convert one string 



3005 
3010 
3015 



30£0 



For I = 1 To L 

C» = Mid*(ST$, I, 1) 

If "9" < Ct find C$ < Chr»<£19) Then 
G$ = Chr*(fisc<C») + 3£ ♦ LF) 
LF = 1 
Print C*j 
Next 
Ret urn 



END OF LISTING 

PROGRfiM LENGTH = 659 BYTES, TOTfiL OF £7 LINE NUMBERS 

51 TOTfiL NON-REM STATEMENTS, 3 TOTfiL REMfiRKS 

END 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



91 










1 ' 








. 




'■^" 


-, 










- 










^^^Pr A^ 


y 








;><rJ 



ing like it before. Nothing else like it no- 



^'''^m 



. brings you continuous Hi-Res action-animation in every adv 

turous moment! And, real running, leaping, crawling. Real fighti 

shooting, stabbing, dynamiting. Real wounding, poisoni 

killing. Real action, excitement, mystery! All in a real-ti 

challenging adventure that's the wave of the futi 




Paul Stevenson's graphic genius, first displayed in 

best selling "Swashbuckler" sword fighting gar 

outdoes itself in AZTEC. You're inside an ancii 

I Aztec pyramid searching for the golden ir 

Descend deep into the heart of the tempi 

meet cobras, scorpions, giant lizai 

f hostile Aztec guardians and more. Wa| 

for hidden trapdoors and strange dee 
rooms. Be ready to fight, or run. craw 
jump to possible safety. The menac 
real, the options and strategy are yoi 
You've never seen an adventure 
Aztec! You'll never tire of its ama2 
action-animation and exciting challer 
$39.95 for the Apple I r At y 
computer store 




MUM*i»»*' 



Utilizing the 6502's 
Undefined Operation Codes 

by Curt Nelson, Richard Villarreal, and Rod Heisler 



This method allows you to use 
the 6502's undefined op codes 
to design new and individualized 
pseudo-instructions under 
program control. A simple 
hardware device attached to the 
data bus forces a simulated 
BRK command when an illegal 
op code is detected. 

Utilizing Undefined 
Op Codes 

requires: 

Hardware modification to a 
6502 microcomputer 

Fetch Cycle 

Before the Central Processing Unit 
[CPU] can execute an instruction it 
must first get the hexadecimal code 
from memory. This process is called a 
fetch cycle. The fetch cycle is identical 
to the data read cycle except for the 
SYNC line operation, which rises to a 
logic level one (5V) shortly after the 
fetch cycle is initiated. 

The fetch cycle (figure 1) starts 
when the system clock, ^2, falls to a 
logic level (OV). For a IMHz system 
clock the fetch cycle normally requires 
1000 nano seconds, or one micro sec- 
ond. During this 1000 nano-second 
period several events occur in well- 
ordered sequence. First, the CPU out- 
puts the current value of the program 
counter on the address bus. This is the 
address location of the next instruc- 
tion. The specified memory then out- 
puts the op code to the data bus. The 
CPU reads the op code from the data 
bus just before the end of the cycle. 

The interval in which the Trapper 
has to operate extends from the time 
the memory device presents the op 
code to the data bus until the CPU 
latches it internally. In this time it 
must determine if the op code is valid 
or not, and force a BRK (00) if it is il- 
legal. The Trapper described in the next 
section requires a maximum of 150 
nano seconds to operate, leaving a mini- 



mum of 525 nano seconds for the mem- 
ory to present valid data to the data bus. 
This, of course, precludes the use of 
very slow memory devices but is ade- 
quate for most microcomputer systems. 

Haidwaie 

The Trapper (figure 2) samples the 
data bus in a parallel mode. The data 
lines are first buffered through IC4 and 
IC5 and then used to form the address 
to IC3, a 256 X 4 PROM. IC3 is always 
enabled and is programmed to output a 
logic state one for an illegal op code and 
a logic state zero for a legal code. Only 
one of the three PROM outputs is used; 
the others are not programmed. 

The falling edge of the 02 clock in- 



itiates the timing cycle for ICl, a 
monostable multivibrator. The output 
of ICl goes high after a period of time 
determined by the RC network. The 
time-out is set for approximately 750 
nano seconds. The leading edge time 
out from ICl is used to clock IC2, a 
dual D flip-flop. The SYNC line is tied 
to the clear input of IC2 through two 
buffers. This combination of inputs to 
IC2 assures that its output will go high 
only if these three conditions are met: 
the SYNC line is high (fetch cycle], an 
illegal op code has been fetched, and 
ICl has timed out. 

The outputs of IC2 are used to drive 
open collector inverters tied directly to 
the data bus. When the inputs to the in- 



Flgure 1: Timing Diagram for the 6502 Fetch Cycle 
(All times in nano (lO-*) seconds) 



SYSTEM CLOCK 



SYNC 
(FETCH CYCLE) 



ADDRESS 
FROM CPU 



DATA FROM 
MEMORY 



DATA READ 

BY CPU L 




OPERATION TIME OF ILLEGAL OP CODE TRAPPER 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



93 



verters are high (illegal op code), the 
outputs force the data lines to a logic 
state zero, simulating a BRK command. 
When the inputs to the inverters are 
low, as under non-trapping conditions, 
the output appears as a high impedance 
to the data bus. If the data lines are 
pulled low, they are released when the 
SYNC line goes low during the next 
clock cycle. 

Software 

The task of the software is two-fold. 
First, it must determine if the break 
was the result of an illegal op code or a 
BRK instruction. Second, if the Trapper 
forced the break, it must retrieve the il- 
legal op code and direct the CPU to the 
proper software routines. 

The CPU handles the software BRK 
and an IRQ (Interrupt ReQuestJ simi- 
larly, except for one small feature. A 
BRK command sets the break bit (bit 
four) in the processor status register. 
The CPU will then do an indirect jump 
through the IRQ vector at FFFE and 
FFFF. The user must load the address of 
the break-handling routine into the 
IRQ vector prior to the detection of an 
illegal op code, to direct the CPU to the 
user routine. Listing 1 shows the soft- 
ware used to change the IRQ vector. A 
starting address of $0300 was used for 
the break service routine, but this is 
arbitrary. 

The user's break-handling routine 
must determine whether a BRK or an 
IRQ was encountered. This is done by 
retrieving the processor status from the 
stack (it was automatically pushed 
there when the break occurred) and ex- 
amining the break bit. If it is determined 
that bit four is set and hence a break 
has occurred, it retrieves the last op 
code. This is easily done because the 
address of this instruction plus two was 
also pushed on the stack when the pro- 
gram was interrupted. If this instruc- 
tion was a BRK, control is passed back 
to the system monitor. If, on the other 
hand, it was an illegal op code, control 
is passed to a user program that imple- 
ments new micro-coded instructions. 

There are several methods to jump 
to the user code corresponding to each 
new instruction. The most straight- 
forward way is to use a CMP instruc- 
tion followed by a BEQ for each ele- 
ment in a list of new hex op codes. If 
more than just a few instructions are 
added, a more elaborate scheme may be 
necessary to reduce the execution time 
and program length. In this situation 



Figure 2: Schematic diagram of the illegal op code Trapper. The board Is compatible 
with any 6502 system bus. All lines to the board are generated by the 6502 CPU. CI is 
a silver mica capacitor and R1 is a low-temperature coefficient, precision resistor. 

Cl R1 

68 pF 20K +5 

■j ( — t-WVV^-C> 




you may want to use a jump table to 
build this case/select structure. 

The break service routine in listing 
2 is completely transparent [i.e., all 
registers are preserved). The illegal op 
code is returned at address $0042. The 
address is arbitrary and can be changed 
to any convenient location. 

If the user exits the break service 
routine at line 23, indicating an IRQ, he 
should use the following sequence to 
restore the original registers: 

PLA 

TAX 

PLP 

PLA 
If the routine is exited at line 40, in- 
dicating a normal BRK command, the 
following sequence should be used: 

PLP 

PLA 
Programming the PROM is under- 
stood by examining figure 2. Since the 
system data bus is connected to the ad- 
dress lines of the PROM, the hex op 



codes become the address to this 
device. Therefore, all legal op code- 
based addresses store 0000 and all il- 
legal addresses store 0001. 

Conclusion 

I'his method of detecting illegal op 
codes is really a hardware implementa- 
tion of a macro assembler directive. 
Although the execution time and mem- 
ory space required are more than the 
standard JSR technique, writing and 
debugging programs is more straight- 
forward when microcoded routines are 





Figure 3 






Number 


Type 


+ 5V 


Gnd 


ICl 


74LS123 


16 


8 


IC2 


74LS74 


14 


7 


IC3 


74S287 


16 


8 


IC4,5 


74LS04 


14 


7 


IC6,7 


7405 


14 


7 



94 



MICRO - The 6502/6809 Journal 



No. 55 - December 198 



Listing 1: Software to modify the IRQ vector to point to a user program. 



0800 


1 


SBTVING 


UP THE IRQ VB 


ceoo 


2 






0800 


3 






0200 


4 




ORG $200 


0300 


5 USRPPG 


EQU $0300 


tVfK 


6 


[RQIOW 


B3U $FFFE 


FFFK 


7 


CaOlIG 


B3U IRQLa»+-$l 


0200 


8 






0200 


9 






0200 


10 


INITIALIZATION 


0200 


11 






0200 


12 






0200 A9 00 


13 




UDA #USRPB3 



0202 8D FE FF 

0205 A9 03 

0207 8D PF FF 

020A 

020A 

020A 

020A 

020A 



14 
15 
16 
17 
18 
19 
20 
21 



STA IRQIOW 
IXA /USRPRG 
STA IROJIG 



ADDRESS OF LEER PROGRAM 
WM ADDRESS OF IRQ VECTOR 
llSi ADDRESS OF IRQ VECTOR 



;SEn' IRQ VECTOR TO LEER BREAK. 
RDOTINE 



MAIN PROSiAM 



Listing 2: Program to h^ndie a brealc service routine. Determines whether a brealt or 
an iRQ has interrupted the system and transfers control to the proper location. 



oaoo 






1 


0800 






2 


0800 






3 


0800 






4 


0300 






5 


0380 






6 


03A0 






7 


0040 






8 


0041 






9 


0042 






10 


0104 






11 


0105 






12 


0106 






13 


0300 






14 


0300 






15 


0300 


48 




16 


0301 


08 




17 


0302 


3A 




18 


0303 


48 




19 


0304 


BA 




20 


0305 


BD 


04 01 


21 


0308 


29 


10 


22 


030A 


FO 


74 


23 


030C 


BD 


06 01 


24 


030F 


85 


41 


25 


0311 


SD 05 01 


26 


0314 


85 


40 


27 


0316 


DO 


02 


28 


03 W 


Cb 


41 


29 


03 lA C6 


40 


30 


031C 


DO 


02 


31 


031E C6 41 


32 


0320 


C6 


40 


33 


0322 


A2 


00 


34 


0324 


Al 


40 


35 


0326 


85 


42 


36 


0328 


68 




37 


0329 


AA 




38 


032A A5 


42 


39 


032C 


FO 


72 


40 


032E 


28 




41 


032F 


68 




42 


0330 






43 


0330 






44 


0330 






45 


0330 






46 


0330 






47 


0330 






48 


0330 






49 


0330 






50 


0330 






51 


0330 






52 


0330 


E6 


40 


53 


033-1 


00 


02 


54 


0334 


E6 


41 


55 


0336 


6C 


40 00 


56 


0339 






57 



BREAK SERVICE ROiirCME 



IRQSER 

USRBRK 

SAVU5W 

SAVHIG 

SAVDPC 

FlAG 

ADDU>f 

ADCHIG 



SKIP 



SKIP! 



ORG $300 
EOT $380 
EOT $3A0 
EP2 $40 
EP2 SAVI£»*f$l 
EPZ SA\HIG*-$1 
EOT $104 
0QU $105 
EOT ADDI£1W-$1 



HIA 

HIP 

TXA 

MA 

TSX 

I£R FIAG,X 

AND #$10 

BED IRQSER 

I£A ADCHIG, X 

STA SA\HIG 

IDA ADDiaW,X 

STA SAVUM 

BNE SKIP 

DEC SAVHIG 

DEC SAVUDW 

BNE SKIP! 

DEC SAUIIG 

DEC SAVUM 

UDX »$00 

U3R (SAVUM.X) 

STA SAV3PC 

PIA 

TAX 

I£A SATOPC 

BEQ UBRBRK 

PIP 

PIA 



LEER ROUTINES 



RETURN TO MAIN PRDC3WM 



Il«: SAVUM 

are SKIP2 

INC SA\HIG 
SKIP2 JMP (SAVUM) 
END 



r STANDARD IRQ SERVICE 
; STANDARD BREAK SERVICE 



; PRESERVE KXl 
; PRESERVE FLAGS 



; PRESERVE X 



;GET FLAGS 



rGET ADD + 2 FROM STACK 



BR IF NOT ON PAGE HOUNDRY 

DEC PAGE 

DEC ILLEGAL OPCODE ADDRESS 

BR IF HO PAGE CROSSED 

DEC PAGE 

DEC ADDRESS AGAIN 

INDEX . 

GET ILU33AL OP CODE 

PRESERVE IT 

RESTORE X 

REIRIEVE ILLEX3AL OP CODE 

BR EOR NORMAL BREAK 

RESTORE FIAGS 

RESTORE sec 



BIWP ICW ADDRESS 

BR IF NO pact: crossed 

BU4P PACS: 



incorporated into your program as sim- 
ple instructions. 

A few words of caution: first, it is 
necessary to acquaint yourself with the 
user-available monitor subroutines on 
your system. The SYM-1, for example, 
has monitor routines to do some of the 
functions in listing 2. The Apple, as 
well, has monitor routines that can be 
used to shorten this program. Second, 
the illegal op code FF rearranges the 
stack and hence should be avoided. 

You are now in a position to expand 
the instruction set of your 6502-based 
system. What instructions should you 
add? Here are a few suggestions: integer 
multiply and divide, double precision 
math operations, jump indirect-indexed, 
push and pull to a user stack, and 
memory to memory transfer. You can 
even add a pseudo B accumulator and a 
16-bit index register. 



The authors may be contacted at the 
School of Engineering, Walla Walla 
College, College Place, Washington 99324. 



JMOK} 



3ttlprTHting ^ftmare T 

presents 
OSI C4P-MF SOFTWARE 




YOU MUST PILOT YOUR WWII VINTAGE 
AIRCRAFT ACROSS A SCROLLING LAND- 
SCAPE AND RESCUE ROW'S IN ENEMY 
TERRITORY. SOME OF THE SMOOTHEST 
GRAPHICS EVER SEEN ON AN OSI! IT 
ALSO USES A NEW TECHNIQUE OF 
USING "LARGE" MULTICHARACTER 
SHAPES FOR A REALISTIC GAME. YOU 
WILL REALLY LOVE THIS ONE! PLEASE 
SPECIFY WHETHER YOU WANT JOY- 
STICK OR KEYBOARD OPTIONS. THIS 
GAME IS SO EXTENSIVE THAT IT TAKES 
UP THE ENTIRE DISK! 
ALLTHIS FOR ONLY $19.95 

SEND TO: Calif, residents 

INTERESTING SOFTWARE add sales tax 
21101 S. HARVARD BLVD. 
TORRANCE, CA 90501 
(213) 328-9422 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



95 



SIG-FORTHVl.O 



Tde only stand-alone P'orth system 
tor OS.L serial machines 



Features : 

Complete Forth source code 
Advanced Screen editor w/source 
6502 macro assembler w/source 
Double number and CASE extensions 
Vectored boot capability 
Several Utility Screens 
Complete glossary 



Dos Includes: 

Bi-Directional NEC driver 
65U read capability 
NMHZ Capability 



$100.00 

POSTAGE 
PAID 



DIGI COM ENGINEERING , INC. 

P.O. Box 165* 
Kodiak, Alaalu (MIS 

ORDERING INFORMATION: Check, money order or C.O.D.'s accepted. 
Shipment VIA Tirst class msij. Allow approximately one week (or delivery. 



BY A PLASTIC CASE 




Were you ever frightened to carry your SV* floppies out of ttie 
security of your home or office, tecause of that flimsy plastic case you 
keep your discs in. 

Store and carry 100 discs safely and securely. 

Each disc pocket is surrounded oy an inch of high density foam 
Inhibits caishing, jamng, summer's heat, and winter's cold. 

100 disc 5% floppy carrying case $39.95 ea. 

Dealer Inquiries Invited. Phone or mall orders accepted. 

Check, Money order, MasterCard, Visa 

For Shipping add $2.00, N.Y. State residents Add Sales Tax 

Product Design and Copyrighl ^ 1982 By Greg Carttonaro 

Unique Sop tcxxuRe inc. 

POST OFFICE BOX N, DEER PARK. NEW YORK 1 1729 (516) 666-7577 



m 



m^MMWM^M #<iP1E'l^i& 



THE TACKLER ™ - DUAL . mode parallel 

INTERFACE FOR THE APPLE" 2 BOARDS IN ONE FOR NO MORE 
COMPATIBILITY PROBlfMS! 

An intelligent board to provide easy control of your printer's full potential. 
Plus a standard parallel board at the flip of a switch - your assurance of 
compatibility with essentially all software for the APPLE". Hires printing 
with simple keyboard commands that replace hard to use software 
routines. No disks to load. Special features include inverse, doubled, and 
rotated graphics and many leit control features, available through easy 
keyboard or software commands. Uses Industry standard graphics 
commands. This is the first truly universal intelligent parallel interface! 
Change printers - no need to buy another board, lust plug in on.e of our 
ROH/I'S and you're all set. ROM'S available for Epson, C. Itoh, NEC, and 
Okidata - others avai lable soon. Specify printer when ordering. Call for 
Price. 




^^ ^^ 




THE UPGRADEflBLE PPC-100 
PARALLEL PRINTER CARD 

A Universal Centronics type parallel printer board complete with cable 
and connector This unique board allows you to turn on and off the high 
bit so that you can access additional features in many printers. Easily 
upgradeable to a fully intelligent printer board with graphics and text 
dumps. Use with EPSON, C. ITOH, ANAOEX, STAR-WRITER, NEC, OKI 
and others with standard Centronics config uration. ^139.00 



IF YOU WANT GRAPHICS AND FORMAHING THEN 
CHOOSE THE PERFORMER 

lor Epson, OKI, NEC 8023, C. ITOH 8510 provides resident HIRES screen 
dump and print formatting in firmware Plugs into Apple slot and easy 
access to all printer fonts through menu with PR// command. Use with 
standard printer cards to add intelligence $49.00 specify printer 




THE MIRROR FIRMWARE FOR NOVATION APPLE CAT 11- 

The Data Communication Handler ROM Emulates syntai of an other popular Apple Modem product 
with improvements. Plugs directly on Apple CAT II Board. Supports Videx and Smarterm 80 column 
cards, touch tone and rotary dial, remote terminal, voice toggle, easy printer access and much more. 
List $39 00 Introductory Price $29.00 



MINI ROM BOARDS 

Place your 2K program on our Mini Rom 
Board. Room forone2716 EPROM. Use in any 
slot but zero. Only $34.95 



DOUBLE DOS Plus 

A piggy- back board that plugs into the disk- 
controller card so that you can switch select 
between DOS 3.2 and DOS 3.3 DOUBLE DOS 
Plus renuires APPLE DOS ROMS. $39.00 



Super Pix 

Hires screendump software lor the Epson, OKI, C. Itoh and Nee 8023. Use with Tymac PPC-100. 
Special $19.95 (Specify Printer) ^^^ 



Mr. Lister - Customer Contact Profiler & Mailer 

A Super Mail List Plus more — up to 1000 Entries on single 3.3 Disk (only 1 Drive required) — 2 
second access time to any name — full sort capabilities — Dual Index Modes — supports new 9 
digit Zip. Easy to follow manual — Not Copy Protected — 4 user defined tables with 26 sort 
selections per table — Beta tested for 6 months — user defined label generation. 
Introductory Price $135. $99.00 Dealer &: Dist. Inquiries Invited. 



APPLE LINK 

A communications system for the Apple* (Requires Hayes Micro Modem) Transmit and receive any 
type of file between APPLES*, Automatic mulb-lile transfer, real time clock indicating file transfer 
time. Complete error check Plus conversation mode. Only one package needed for full transfers, 
Corapatable with all DOS file types, (requires Hayes Micro Modem) $59.00 



THE APPLE CARD/ATARI CARD 



Two sided 100% plastic reference card Loaded with information of interest to all Apple and Atari 
owners. ^^'^^ 



NIBBLES AWAY II 

AGAIN! Ahead of all others. 

• AUTO- LOAD PARAMETERS . . . Frees the user from having to Manually Key in 
Param values used with the more popular software packages available for the Apple II. 

• EXPANDED USER MANUAL . . . incorporates new Tutorials for all levels of 
eipertice; Beginners Flowchart for 'where do I begin' to 'Advanced Disk Analysis' is included. 

• TRACi^SECTOR EDITOR ... An all new TracWSector Editor, including the 
following features; Read, Write, Insert Delete Search, and impressive Print capabilities! 

• DISK DIAGNOSTICS . . Checks such things as: Drive Speed, Diskette Media 
Reliability, and Erasing Diskettes. 

« HIGHEST RATED . . . Best back up Program in Sottalk Poll (Rated 8,25 out of 10). 

• CONTINUAL UPDATES. . . Available from Computer Applications and new listings 
on the sourci ^^'^^ 




Dealer and Distributor Inquiries Invited. 

/MICRO-H^RE DIST. INC. 

PO BOX 113 POMPTON PUdNS, N.J. 07444 

20 1-8 38-9027 



96 



MICRO - The 6502/6809 Journal 



No. 55 - December 1 98 



JMcao 

Short Subjects 



VIC Jitter Fixer 
SuperPET Characters 



by David Malm berg 
by Terry M. Peterson 



SuperPET Characters 

Terry M. Peterson, 8628 Edgehill Ct., 
El Cerrito, CA 94530 



The SuperPET contains a 4K character- 
generator ROM in place of the 2K ROM 
found in normal CBM 8032s. The 4K 
ROM contains four character sets. In 
addition to the two PET/ CBM charac- 
ter sets found in the 2K ROM, there are 
two new sets designed by Waterloo 
Computing Systems — ASCII and APL. 
The Waterloo ASCII character set is 
used in the SuperPET by all the 
Waterloo Micro languages except 
MicroAPL. This article describes some 
of the features of the Waterloo ASCII 
character set that are not well-covered 
in the Waterloo documentation accom- 
panying the SuperPET. 

All the printable ASCII characters 
— codes 32 to 127 — in the Waterloo 
ASCII set are pure ASCII. By this I 
mean they are all recognizable dupli- 
cates of the corresponding character 
found in an ASCII table. Furthermore, 
the PRINTed codes are identical to the 
screen POKE codes for a given charac- 
ter! Many of the screen control codes 
are consistent with normal printer 
usage; e.g., cursor-down = 10 [LF), 
cursor-back = 8 (BS], and clear-screen 
= 12 (FF). This means that turning 



neatly formatted CRT output into 
neatly formatted hardcopy on an ASCII 
printer (like the MX-80] is much easier 
than with the CBM character set (the 
one Gary Huckel of TNW so appropri- 
ately calls 'half -ASCII']. 

Notice I said the printable charac- 
ters, 32 to 127, have the same PRINT 
and POKE codes; but what about 
POKEing the ASCII control codes to 
31? By experiment you will find these 
codes do not all cause the same action 
when POKEd as when PRINTed. The 
POKE characters and PRINT actions of 
these codes are shown in table 1 . The 
codes and 14-30 give an odd little 
white box when POKEd or PRINTed. 
Code 31 gives the Greek letter ji , 
POKEd or PRIlVTed. Codes 1-11, when 
POKEd, give eleven line graphic char- 
acters that are useful for drawing out- 
line boxes or grids. These characters are 
similar to the graphics characters avail- 
able on the Epson MX printers with 
Graphtrax Plus. They are also very like 
one subset of the CBM graphics charac- 
ters; the shifted- zero is an example (see 
table 1). When PRUSITed, most of the 
codes from 1 to 13 perform some sort of 
control fimction, as shown in table 1. 

What about the high-order bit that 
gives the codes 128 to 255? Either 
PRINTed or POKEd, all the codes from 
128 to 255 reproduce, in reverse field, 
their X-minus-128 POKEd counter- 
parts. Although all these reverse-field 
characters are available (and Waterloo 



didn't usurp the RVS key for another 
function), Waterloo ASCII apparently 
has no reverse control code such as in 
the CBM character set. Therefore, to 
print a reverse-field string, each 
character must be extracted from the 
string and tr^msformed by adding 128. 
For example in microBASIC: 



FOR I = 1 TO LEN(CHARSTRING$) 
CHARS = STR$(CHARSTRING$,I,1) 
RVSCHARS := CHR$(128-l-ORD 

(CHARS) ) 
PRINT RVSCHARS; 
NEXT I 

Perhaps this encumbrance is the reason 
reverse-field characters aren't men- 
tioned in Waterloo's documentation? 



VIC Jitter Fix 

David Malmberg, 43064 Via Moraga, 
Fremont, CA 94539 



In my October 1981 MICRO article 
(41:54), "VIC Light Pen-Manship, " I 
pointed out that the locations in the 
VIC chip that return the light pen's 
horizontal screen position ($9006) and 
vertical screen position ($9007) are 









Table 1 




Epson 












CBM Graphics 


Graphtrax + 


Code 


Mnemonic 


ASCn Name 


Print Action 


POKE Character 


Equivalent 


Equivalent 


1 


SOH 


Start Heading 


Home cursor 


Vertical line 


CHR$(221) 


CHR$(156) 


2 


STX 


Start Text 


? (Run) 


Horizontal line 


CHR$(195) 


CHR$(157) 


3 


ETX 


End TeXt 


? (Stop) 


Lower right comer 


CHR$(189) 


CHR$(154) 


4 


EOT 


End Transmission 


Delete 


Lower left comer 


CHR$(173) 


CHR$(153) 


5 


ENQ 


ENQuiry 


Insert 


Upper left comer 


CHR$(176) 


CHR$(134) 


6 


ACK 


ACKnowledge 


Erase to EOL 


Upper right comer 


CHR$(174) 


CHR$(149) 


7 


BEL 


ring BELl 


Cursor right(!) 


Bottom middle comer CHR$(177) 


CHR$(158) 


8 


BS 


Back Space 


Cursor left 


Left middle comer 


CHR$(171) 


CHR$(150) 


9 


HT 


Horizontal Tab 


Tab 


Top middle comer 


CHR$[178) 


CHR$(152) 


10 


LF 


Line Feed 


Cursor down 


Right middle comer 


CHR$(179j 


CHR$(151) 


11 


VT 


Vertical Tab 


Cursor up 


Cross 


CHR$(219) 


CHR$(159) 


12 


FF 


Form Feed 


Clear screen 


Little white box 






13 


CR 


Carriage Return 


Carriage return 


Little white box 







No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



97 



Updates and Microbes 

(Continued from page 91 

Robert R. Ringel of Comstock Park, 
MI, found a hug in COMPRESS (52:89): 

If COMPRESS is processing the 
token for NEXT ($82) one byte before a 
page boundary, it can lose that token 
when it goes to update its addresses for 
the new page. 

To correct this problem, replace the 
STX instruction at $9088 with $86E3 
and the corresponding LDX instruction 
at $908E with $A6E3. Zero page loca- 
tion $E3 is an unused location that 
works well for a temporary location in 
this instance. 

COMPRESS Removes Variables 

Warren Fiiedman, from Berkeley, 
CA, sent in this update: 

The program COMPRESS, well 
written and clearly described by Barton 
M. Bauers (MICRO 52;89) removes any 
variable names appearing after NEXT 
statements. It does this by ignoring all 
characters until the following colon or 
the end of the program line (see $93EC - 
$93EF). This could cause problems in 
two cases. 

The first problem occurs when 
several variables are used with one 
NEXT, as in NEXT I,J. The second case 
is when a NEXT variable must be 
stated. This may occur with nested 
loops in which the inner loop NEXT is 
the result of an IF... THEN statement. 
(Editor's note: A poor programming 
practice. Loops should be cleared before 
exiting or else stack overflow can occur.) 

These problems with NEXT can be 
solved by treating NEXT in the same 
way an IF statement is dealt with, 
which is to leave it as the programmer 
wrote it. (Bauers calls this a Terminal 
Command.) This is done by changing 
one byte of COMPRESS. First BLOAD 
COMPRESS, then, in BASIC, POKE 
37871,72 (or, in the monitor, enter 
93EF:48). Then BSAVE COMPRESS, 
A$9000,L$600. 

Similarly, programmers who use & 
statements (and who do not mind have- 
ing LET statements remain in the pro- 
gram, if there are any) can change lines 
460 and 461. In BASIC, POKE 
37873,202 : POKE 37874,240 : POKE 
37875,68 (or, in the monitor, enter 
93F1:CA FO 44). The two lines of 
COMPRESS become 



Short Subjects (continued) 



subject to noise. These noisy registers 
can cause the pen's readings to jitter 
about the screen. The October article 
presented a machine-language routine 
that eliminated this jitter problem by 
taking seven separate readings of the 
pen's coordinates, sorting them, and 
returning the median readings (thus ig- 
noring the jittery readings that should 
be at one extreme or the other of the 
sorted list). This routine also calcu- 
lated the light pen's screen row and col- 
umn for the special case of an Atari or 
Commodore light pen. 

Having recently experimented with 
the use of the Atari VCS's game paddles 
with the VIC, I discovered that the left 
($9008) and right ($9009) game paddle 
registers also suffer from jitter prob- 
lems. This can be very frustrating when 
you are playing a paddle game like 
PONG or BREAKOUT and the paddles 
occasionally bounce around the screen 
as if they were possessed by evil com- 
puter spirits. The severity of the prob- 
lem seems to be a function of the game 
paddle unit itself — my neighbor's pad- 
dles are much noisier than mine. 

The BASIC subroutine, given in 
listing 1, POKES into the VIC's cassette 
buffer a machine-language routine that 
provides a general solution to this jitter 
problem. To use the routine in your 



paddle programs, follow these steps; 
1 . append the subroutine to your game 
paddle program, 2. GOSUB 1000 at the 
start of the program to load the 
machine code into the cassette buffer, 
3. SYS(828] to read both paddle 
registers, and 4. get the left paddle's 
un-jittered reading by PEEKing 936 and 
the right by PEEKing 937. Be sure to 
use this routine cautiously in any pro- 
gram that is doing tape input or output 
because of the risk of clobbering the 
machine code in the cassette buffer. 

This same routine may also be used 
to un-jitter the light pen reigsters by 
deleting lines 1190 and 1200. The 
resulting machine code is more uni- 
versal than the version given in the 
October 1981 article because it can be 
used with any light pen, rather than 
just the Atari and Commodore pens. 

Should other VIC chip registers be 
discovered that suffer from jitter, they 
can be easily handled with this routine 
by merely POKEing the low byte of 
their addresses into locations 835 and 
857. See line 1190 of the listing where 
this is done for the game-paddle 
registers, 

Because this program is very similar 
to the one presented in my previous 
article, a full assembly listing is not 
given. 



C9CA 
F0 44 



CMP #$CA 
BEG IF 



;is it '&'? 
;yes 



JMCRO 



Jitter Fixer Subroutine 



10130 REM MACHINE LflNGUflGE ROUTINE TO READ ' JITTERY ' UIC LuCflT 

leie REM SUCH hS LIGHT PEN COOROINflTES Oft G.W-1E PhDDLE iETTIMG; 

1820 REM ;.VS(:S2S:j to read '.'SLUES RETURNED IN LOCATIONS 93, 

1030 FOR 1= 823 TO -fJS :REflD DC: POKE I, DC: NEST I 

1040 DflTfl I.i£,0.,l.i0,.3,132..152.,l,^3..i..l44 

1050 DATA 1. i0, 171, 132,151,32,13-3,3.. l.i? 

10,i0 DATA ISl, 24, 10-;-, 1.70, .3, 133, 151 ,144,2 

1 070 DATA 230 , 1 52 , 1 73 , 7 , 1 44 , 32 , 1 33 , 3 , 232 , 23.i 

1050 DATA 170,3,240,9, l-iS, l,i2, 197, l,i2, 240 

1090 DATA 252,7.i,d.2,3,173,170,3,74,l,iS 

1100 DATA 177,151 ,141, l.iy, 3, l,i9, 171,133 

1110 DATA 151, l.i9,. 3, 13-3, 152, 177, 151 ,141 

1120 DATA l.i.3,3,99,142,l.iS,3,172,l.i.S,3 

1 1 30 DATA 1 92 , , 2 40 , 22 , 1 34 , 209 ,151 , 200 

1140 DATA 17.i, l.:.,134,141,l.ii:i,3,177,151 

1150 DATA 200, 145, 151, 13,i, 173,199,3,5.-. 

1160 DATA 1.7,i, 230, 145, 151, 9,4, 0,0, 7 

1170 REM ROUTINE WILL NORMALLY READ i3HrlE PADDLES 

11S0 REM TO READ LIGHT PEN COORDINATES, DELETE THE NEXT 

1190 POKE S.35,.S:P0HE S57,9 

1200 POKE 84S,149:P0KE .S.i9, 255 : POKE S70,233:POKE S71.1:pp 

1210 RETURN 



IONS 
AND 



i.tatement; 



IMCftO 



98 



MICRO - The 6502/6809 Journal 



No. 55 - December 198; 



JMCQO 

New Publications 



So we can list more of the many new 
books now available, we are offering 
New Publications in a different format. 
We think you'll find this increased 
sampling of computer literature useful. 
Library of PET Subroutines, by Nick 
Hampshire. Hayden Book Company, 
Inc. (Rochelle Park, NJ), 1982, 140 
pages, paperback. 
ISBN: 0-8104-1050-8 $14.95 

PET Graphics, by Nick Hampshire. 
Hayden Book Co., Inc. (Rochelle Park, 
NJ), 1982, 218 pages, paperback. 
ISBN: 0-8104-1051-6 $16.95 

Computer Consciousness: Surviving 

the Automated 80 's, by H. Dominic 

Covvey and Neil Harding McAlister, 

Addison-Wesley Publishing Company, 

Inc. (Reading, MA], 1982, 211 pages, 

paperback. 

ISBN: 0-201-01939-6 $6.95 



Atari Sound and Graphics, by Herb 
Moore, Judy Lower, and Bob Albrecht. 
John Wiley & Sons, Inc. (605 Third 
Ave., N.Y.C., NY 10158), 1982, 234 
pages, paperback. 
ISBN: 0-471-09593-1 $9.95 

The Creative Apple, Edited by Mark 
Pelczarski and Joe Tate. Creative Com- 
puting Press (Morris Plains, NJ), 1982, 
448 pages, paperback. 
ISBN: 0-916688-25-9 $15.95 

The VisiCalc Book, Apple Edition, by 

Donald H. Beil, Reston Publishing 
Company, Inc. (Reston, VA], 1982, 301 
pages, paperback. 
ISBN: 0-8359-8398-6 $14.95 

The Third Book of Ohio Scientific, by 

S. Roberts. ELCOMP Publishing, Inc. 

(Postbox 1194, Pomona, CA 91769), 

1982, 137 pages, 5^ x 8^ inches, 

paperback. 

ISBN: 3-921682-77-0 $17.95 

Kilobaud Klassroom, by George Young 
and Peter Stark. Wayne Green Books 
(Peterborough, NH 03458), 1982, 419 
pages, 6x9 inches, paperback. 
ISBN; 0-88006-027-1 $14.95 



Computers for Kids, by Sally Green- 
wood Larson. Creative Computing 
Press (P.O. Box 789-M, Morristown, 
NJ 07960), 1981, 73 pages, paperback. 
ISBN: 0-916688-21-6 $4.95 

Ciarcia's Circuit Cellar, Volume III, by 

Steve Ciarcia BYTE/McGraw-Hill (70 

Main St., Peterborough, NH 03458), 

1982, 228 pages, 8 1/4 x 11 inches, 

paperback. 

ISBN: 0-07-010965-6 $12.95 

Techniques for Creating Golden Deli- 
cious Games for the Apple Computer, 

by Howard M. Franklin, Joanne Kolt- 
now, and Leroy Finkel. John Wiley and 
Sons, Inc. (605 Third Ave., N.Y.C., NY 
10158), 1982, 150 pages, paperback. 
ISBN: 0-471-09083-2 $12.95 

BASIC for Business by Douglas 
Hergert. SYBEX (2344 Sixth Street, 
Berkeley, CA 94710), 1982, 223 pages, 
7x9 inches, paperback. 
ISBN 0-89588-080-6 $12.95 

Computers for People by Jerry Willis 
and Merl Miller. Dilithium Press (P.O. 
Box 606, Beaverton, OR 97075), 1982, 
200 pages, 5 54 x 8V4 inches, paperback. 
ISBN: 0-918398-64-9 $7.95 

iMCRO 



BUY! SELL! TRADE! 

COMPUTER & HAM EQUIPMENT 

r COMPUTERS 



I TRADER 

PERMANENT 
SUBSCRIPTION 

$10.00 

Low Ad Rates — Mailed Monthly 



FOREIGN SUBSCRIPTICNS $25.00 YEMl 



COIVIPUTER TRADER 

Chet Lambert, W4WDR 

1704 Sam Drive • Birmingham, AL 35235 

(205) 8540271 

Please include your Name, Address, Call Sign or Phone Number 



OCB-9 SINGLE BOARD COMPUTER 



6809 BASED 

RUNS TSC FLEX DOS 

• QCB-9/1 S-100BUS 

• QCB-9/2 SS-50 BUS 



$149.00 



♦PARTIAL KIT 

FEATURES 




• 5Vi" Floppy Controller 

• Serial RS-232 Fori 

• Centronics Type Printer Port 

• Keyboard/Parallel Port 

• 24K Bytes ot Memory 

• QBUG Resident Monitor 

• 6802 Adaptor 

FULLY ASSEMBLED 

& TESTED $389.00 

• 48-hour Burn-in 
'• 90 Day Warranty 



NAKED-09 SS-50 6809 CPU CARD $49.95* 

* IK .OF RAM AT E40fl Assembled 8, Tested J149.00 oocumenfation 

* 6K OF EPROM AT E80fl-FFFF 2 MHZ Version $189,00 Only 

* HIGH QUALITY DOUBLE SIDED PCB * SOLDER MASKED * SILK SCREENED 



TSC, FLEX DOS, ASSEMBLER, EDITOR 



S150.00 



QBUG RESIDENT MONITOR 

* Disc Boot * Memory Test 

* Memory Exam & Exchange * Zero Memory 

* Memory Dump * Fill Memory 



S50.00 

* Break Points 

* Jump to User Program 

* Register Display & Change 



QBUG IS A TRADEMARK OF LOGICAL DEVICES INC , ' Copyright 1981 
PHONE ORDERS: (305) 776-5870 

LOGICAL DEVICES INC. 

COMPUTER PRODUCTS DIVISION 
781 W. OAKLAND PARK BLVD. • FT. LAUDERDALE, FL 33311 

TWX: 510-955-9496 • WE ACCEPT VISA. MC, CHECKS. COD,, MONEY ORDER 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



99 



/MOH) 

Reviews in Brief 



Product Name: Spellmaster 

Equip, req'd: Commodore 80-column screen and 

dual disk (40- and 64-column versions 

expected soon) 

For Wordpro files (Wordcraft & Silicon 

Office versions planned) 

Uses functional 4K ROM at $9000 
Price: $195 

$ 75 for legal or medical dictionary 

options 
Manufacturer: Management Systems Alternatives 

6219 Thirteenth Avenue South 

Gulfport, FL 33707 
Description: Finally, a decent spelling checker for CBM 
computers! Highly recommended for word-processing 
writers who do not spell well. 

Pluses: It is far faster than its only competitor and has an 
honest 40, 000- word dictionary. Spellmaster presents 
suspect words for editing in context in reverse field on a 
typical Wordpro screen display. Suspect words may then 
be easily corrected or added to the dictionary for future 
reference [up to 3,000 more words on the 4040, and 20,000 
more on the 8050). Corrected files are resaved to disk, 
avoiding the hassle of reloading the word processor and 
searching for the errors. The program is mostly self- 
documenting, though it comes with a typical manual. 
There is a HELP screen in the program and useful prompts 
throughout. 

Minuses: When editing, it is easy to skip past a word that 
needs to be repaired or added to the dictionary. At present, 
there is no way to back up except by aborting and restarting 
the edit. The company is attempting a fix. 

Skill level lequiied: Users should be fairly familiar with 
Wordpro and willing to spend about an hour reading the 
Spellmastei manual before use. 

Reviewer: Jim Strasma 



Product Name: 
Equip, req'd: 
Price: 
Manufacturer: 



Electric Duet 

Apple II or Apple 11 Plus 

$29.95 

Insoft 

10175 Barbur Blvd., Suite 202B 

Portland, OR 97219 

Paul Lutus 



Author: 

Copy Protection: Yes 

Language: 6502 Assembly 

Description: A software-only music synthesis system for 

generating 2-part music on an Apple with no additional 

hardware required. 



Pluses: An external speake:r can be used to improve fidelity 
via the cassette port. The package includes a music editor 
for constructing tunes, with several sample tunes. A com- 
bined display allows for the simultaneous entering and 
playing of music. Entered scores can be transposed both in 
key and in tempo. Each note played may have one of four 
voices. Notes can be entered either into an editor or played 
directly from the keyboard. Then the music can be incor- 
porated directly into user programs! The storage format of 
the music is described for the more advanced programmer 
who may wish to access the binary score directly. 

Minuses: The manual is brief (17 pages) but complete. 
Although the author has permitted the user to play music 
directly from the Apple keyboard (using the upper row of 
keys for one note and the lower for the other), I personally 
found this feature awkward to use. The editor is much 
more complete for entering music from the keyboard. As 
mentioned in the manual it is included only for familiari- 
zation. Deletion of a line using the music editor is not a 
single stroke command. To accomplish a line deletion, a 
file must be opened so that the line to be deleted is the 
last. Then deletion will remove it. After working with 
Musicomp, Paul Lutus' first music editor, I was spoiled by 
his hi-res display of notes in motion. I would love to have 
seen that feature retained in Electric Duet. However, by 
obtaining 2-part music with no hardware, at a fraction of 
the cost of popular music boards, this program should be 
considered carefully before investing in more expensive 
alternatives. 

Skill level required: Fairly easy for the novice to master 
with a little practice. 

Reviewer: David Morganstein 



Product Name: 
Equip, req'd: 



Price: 
Manufacturer: 



TermiQal-40 

VIC-20 

8K (or more) of extra memory 

VICMODEM or RS-232 compatible 

modem 

$29.92 

Midwest Micro Associates 

P.O. Box 6148 

Kansas City, MO 64110 
Author: Dr. Jim Rothwell 

Description: Tenninal-40 is an extremely powerful 
telecommunications program for the VIC-20. This 
machine-language program is fast enough to support up to 
2400 baud, is quite flexible, and allows you to specify 
dupleX; parity, wordsize, stopbits, linefeed, and baud rate 
options. Through software, TeTminal-40 displays a 
40-character line with each character represented by a 3 x 6 
matrix. All characters tire shown as upper case and are 
quite readable. Tenninal-40 also has a 4K or larger buffer. 



100 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Reviews in Brief (continued) 

which can be used to capture copies of the material being 
transmitted or received for later study or dumping to the 
printer. 

Pluses: A versatile and exceedingly well-done package. 
The 40-column display is great! 

Minuses: Although Terminal-40 supports the printer, it 
does not handle the disk, nor is there any way to use it to 
transmit or receive a program. The program comes on an 
"auto-start" tape and cannot be copied to disk or another 
tape. 

Documentation: The 20-page manual is clear and 
comprehensive. 

No special skills required. 

Reviewer: David Malmberg 



Product Name: 
Equip, req'd: 



Price: 
Manufacturer 



Doubletime Printer 

Apple n Plus 

Any of the popular printers 

$99.95 

Southwestern Data Systems 

P.O. Box 582 

Santee, CA 92071 

(714) 562-3221 
Description: Double Piintei permits printing to take place 
as a background task. You can continue to use your com- 
puter while it is printing rather than being "frozen out." 
This should prove particularly valuable in word processing 
applications. 

Pluses: The product is extremely versatile. Applesoft, 
binary, or text files are printed without conversion. For- 
matting commands are available and easy to use. 

Minuses: The product is not easy to get up and running. It 
requires a ROM chip change, a board installation, and a 
diskette boot. All this could be dealer-performed for the 
more timid user. It is worth the trouble. 

Documentation: The instructions are well-written but 
quite technical. 

Skill level required: An intermediate familiarity with the 
Apple is necessary. 

Reviewer: Chris Williams 



Product Name: Apple-Cillin U 

Equip, req'd: Apple n or Apple II Plus with disk 

drive (13- or 16-sector) 
Price: $49.95 

Manufacturer: XPS, Inc. 

323 York Road 

Carlisle, PA 17013 
Description: This diagnostic utility tests RAM and ROM 
chips, the disk system, peripheral cards, keyboard, CRT 
display, printer, tape recorder, game controls, and CPU 

(Continued on next page) 




PTD-6502 is a high speed, compiled BASIC-like lan- 
guage, light years ahead of the Apple II Single Stepper 
and far more sophisticated than any other 6502 de- 
bugger available. It allows you to sit back effortlessly 
while your computer glides through your code at a thou- 
sand instructions per second looking for your bugs. Or 
you can select a slower speed with updated display of 
memory. A paddle-controlled single stepper mode Is 
also available. At either of the slower speeds, the 
PTD-6502 monitors and saves the last 1 28 instructions 
executed for review at any time. 

Virtually unlimited breakpoint complexity is per- 
mitted with the PTD-6502. IF statements with mixed 
AMD's and OR's can be created to test conditions such 
as memory change, memory = value, instruction loca- 
tion, . . . and many others. You can have as many named 
breakpoints as you wish in both ROM and RAM. 

Some other features of the PTD-6502 include • Fast 
subroutine execution. • Hex calculator/converter. 

• Hex/ASCII memory dump. • Up to 16 machine lan- 
guage cycle timers. • Ability to monitor specific labeled 
areas in memory while stepping. • Effective address. 

• Accessible monitor commands. • A documented mod- 
ule for relocation of the PTD-6502 to virtually any loca- 
tion (source code supplied). 

The debugging program shown on the monHor is a 

simple example; it could be far more complex. If you can 
think of it, you can probably scan for it at 1000 instruc- 
tions per second. If you're a professional, the PTD-6205 
can pay for itself in the first few hours of use. If you're a 
novice, you'll soon be debugging like a pro. 



ORDER: PTD-6502 Debugger 

including DOS 3.3 Disk 

and instruction manual 



$49.95 



(Note that disk is not copy protected. Order only 
one for each business or institution.) In Califor- 
nia, add 6.5% sales tax. 
PTD-6502 requir€!S Autostart ROM for fast breakpoint. 

PTERODACTYL 
SOnWARC® 

1452 Portland Ave. • Albany CA 94706 • (415) 525-1605 




No. 55- December 1982 



MICRO - The 6502/6809 Journal 



101 



r«^ 







Let Unique Data Systems help you raise your sights on AIM 65 
applications with our versatile family of AIM support products. 

•Go for high quality with our ACE-100 Enclosure. It accom- 
modates the AIM 65 perfectly, without modification, and features 
easy access two board add-on space, plus a 3" x 5" x 1 7" and a 
4" X 5" X 15.5" area for power supplies and other com- 
ponents. $186.00. 

• Get high capability with Unique Data System's add-on boards. 
The UOS-100 Series Memory-I/O boards add up to 16K bytes of 
RAM memory or up to 48K bytes ROM/PROM/EPROM to your 
Rockwell AIM 65. You also get 20 independently programmable 
parallel I/O lines with an additional user-dedicated 6522 VIA, two 
independent RS-232 channels with 16 switch-selectable baud 
rates (50 to 19.2K baud), and a large on-board prototyping area. 
Prices start at $259.00. „ ^ 

• If you need to protect against RAM data loss, the UDS-100B of- 
fers an on-board battery and charger/switchover circuit. $296.00. 

• Heighten your AIM 65's communications range by adding the 
UDS-200 Modem board. It features full compatibility with Bell 
System 103 type modems and can be plugged directly into a 
home telephone jack via a permissive mode DAA. No need for a 
data jack or acoustic coupler. The UDS-200 also has software- 
selectable Autoanswer and Autodial capability with dial tone 
detector The modem interfaces via the AIM 65 expansion bus, 
with the on-board UARTand baud rate generator eliminating the 
need for an RS-232 channel. $278.00. 

• The UDS-300 Wire Wrap board accepts all .300/.600/.900 IC 
sockets from 8 to 64 pins. Its features include an intermeshed 
power distribution system and dual 44-pin card edge connectors 
for bus and I/O signal connections. $45.00. 

• Get high performance with the ACE-1 00-07 compact 4" x 5' x 
1 .7" switching power supply delivering + 5V @ 6A, -(- 12V @ 1 A, 
and +24V for the AIM printer $118.00. 

Installation kits and other related accessories are also avail- 
able to implement your AIM expansion plans. Custom hard- 
ware design, programming, and assembled systems are also 
available. High quality, high capability, high performance, with 
high reliability. . . all from Unique Data Systems. Call or write 
for additional information. 

Unique Data Systems Inc. 
1600 Miraloma Avenue, Placentia, CA 92670 

(714)630-1430 



Reviews in Brief (continued) 



registers. Disk tests include sequential and random 
writing and reading, random track seeking, and drive 
speed. 

Pluses: Single or multiple tests may be repeated con- 
tinuously, with results optionally printed. The program is 
menu-driven, user-friendly, fast, and crash-resistant. 

Minuses: The style and depth of the documentation are 
marginal. 

Documentation: The 24-page manual is neatly formatted 
and printed. The writing is comprehensible but often 
awkward and unpolished. It describes in detail how to use 
the program, but gives almost no help to analyze and cor- 
rect problems it finds. 

Skill level lequiied: Little skill is needed to run it, but 
moderate hardware knowledge is required to know what to 
do about reported problems. 

Reviewer: Jon R. Voskuil 



Product Name: SPELL 'N FIX 

Equip, req'd; TRS-80C, with disk or cassette, 32K; 

other versions available for FLEX, 

OS-9, and other systems. 
Price: $69.29 (FLEX version $89.29! 

Manufacturer: Star Kits 

P.O. Box 209 

Mt. Kisco, NY 10549 
Description: SPELL 'N FIX is a package of program files 
that provides a dictionary for Color Computer text files. 
The main program, SPELLFIX, loads and executes a 6809 
machine-language dictionary look-up program. A 
20,000-word dictionary tile is used to check ASCII files for 
spelling and typographical errors. Other files included are 
utilities for writing and reading ASCII files, a sample text 
file, binary-to-ASCn conversion programs, and a program 
to expand the dictionary. These programs allow you to use 
SPELLFIX with processors that create binary files. 

Pluses: The dictionary program is expandable when using 
the disk version, and you can create your own dictionary 
that fits your writing style. Questionable words are dis- 
played, and/or printed in alphabetical order for checking. 
The disk version also allows marking of questionable 
words for later correction, or they may be corrected 
immediately. Large files usually take only slightly longer 
to correct than smaller files. It will work on most files that 
are larger than RAM memory. The disk version can be 
easily converted to tape, and vice versa. 

Minuses: The tape version cannot mark or immediately 
correct text files. Not directly compatible with Color 
Scripsit files, though, Scripsit can print an ASCII file to 
tape, which can be read by the dictionary. 

Documentation: A 25-page manual is included that 
thoroughly explains the proper operation of the programs. 
Information is also provided on modifying and creating 
new dictionaries. No instructions were included foi 
removing words from the dictionary. 

Skill level required: With only a few minutes of study, 
anyone should be able to operate the program. 

Reviewer: John Steiner JMCftO 



102 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



/MCftO 

Software Catalog 



Name: Data Tape Maker 

System; OSI 

ClP/Superboard II 
Memory: 4K 

Language: 8K BASIC in ROM 
Description: Data Tape Makei 
is a relatively short program 
that allows you to save 
machine-language code or any 
other data stored in con- 
secutive memory locations in 
DATA statements on tape. 
The sign space fox each 
number is eliminated to allow 
for compact storage of data. A 
FOR/NEXT loop is automatic- 
ally generated to restore the 
data into memory at a later 
time. 
Price: $4.00 for tape 

$3.00 for listing 
Author: Brian Zupke 
Available: 

B.C. Software 

5152 Marcell Ave. 

Cypress, CA 90630 



Name: Air Navigation 

Trainer 

System: Apple II or Apple 
II Plus, Applesoft 
in ROM or 
Language Card 
Memory: 48K 
Language: Applesoft and 

Machine Language 
Hardware: One disk drive 
|DOS 3.3) and 
game paddles 
Description: Aii Navigation 
Tiainei is a real-time simula- 
tion of aircraft navigation with 
hi-res instrumentation and 
ground-track map, sound ef- 
fects [including station IDs), 
dial-in wind magnitude and 
direction, four different simu- 
lations, dual independent 
VORs |VHF Omnirange Radar) 
with adjustable OBS (just like 
the real thing), ADF, NDBs, 
and more. 
Price: $40.00 
Includes program diskette 
and full documentation. 
(Not for pilots only!) 
Author: Ken Winograd 
Available: 
Space-Time Associates 
20-39 Country Club Drive 
Manchester, NH 03102 
(603) 625-1094 



Name: Spellmastei 

(PioofReading 
Software) 

System: CBM 8032, CBM 
8096, SuperPET, 
Commodore 64 
Memory; 32K minimum 
Language: Assembly (6502) 
Description: Spellmastei iden- 
tifies and allows correction of 
misspellings from wordproces- 
sing text. It has a 40,000-word 
capacity on the CBM 8050. 
Suspect words are displayed on 
screen, and direct screen 
editing of mistakes is pro- 
vided. Available for WordPro, 
Wordcraft, Silicon Office. It 
will proofread a large WordPro 
file in two minutes or less. 
Legal and medical dictionaries 
are available for $75. 

Price: $199.00 

Author: Dwight Huff and 

Joe Spatafora 
Available: 

Spellmaster Systems 
Software 

6219 13th Avenue South 

Gulfport, FL 33707 

(813) 347-6733 



Name; Rail Runner 
System: TRS-80 Color 

Computer or TDP 
System 100 
Memory: 16K 
Language: Assembly 
Hardware: Cassette or disk 
Description: Your railroad 
engineer must scurry over the 
track of the busiest train 
switchyard ever, dodging 
speeding trains and handcars, 
to rescue the poor little hoboes 
on the wrong side of the 
tracks. You have only so much 
time to save all the hoboes! 
With many levels of difficulty, 
this action graphics game is 
fun for everyone. 
Price: $21.95 cassette 

$26.95 disk 

plus $2 shipping 

Includes cassette or disk 

with instructions. 
Author; BJ 
Available: 

Computerware 

Box 668 

Encinitas, CA 92024 

(7141 436-3512 



Name: K-Star Patrol^M 

System; Atari 400/800 
Memory; 8K 
Language: Machine Code 
Hardware: ROM cartridge 
Description: An exciting galac- 
tic encounter between the 
player's patrol flight and an 
onslaught of attacking alien 
craft. The player's mission is 
further complicated by a 
voracious intergalactic leech, 
and the aliens' low-level 
avoidance system. High degree 
of challenge and entertain- 
ment for even the most ex- 
perienced player. 
Price: $39.95 suggested retail 

Includes ROM cartridge and 

full color instruction 

booklet. 
Author; Dr. Keith Dreyer and 

Torre Meeder 
Available: 

K-Byte 

1705 Austin 

Troy, MI 48084 

or your local computer 

software retailer 



Name; Death Race '82 

System; Apple II with 

Applesoft in ROM 
Memory; 48K 
Language; BASIC/Assembler 
Hardware; One disk drive, 

game paddles 
Description: Death Race '82 
combines the skill of perilous 
driving with the thrill of a 
high-speed chase. Behind you 
is a robot car fully equipped 
with high-technology lasers. 
Your successful escape de- 
pends on maneuvering your 
turbo car through the enig- 
matic curves of ten con- 
secutive mazes, and foiling 
your pursuer through the 
clever use of bazooka rockets 
and oil slicks. Ten different 
speeds ranging from novice to 
expert offer hours of fun before 
proficiency is achieved. 
Price; $29.95 

Includes disk and 

documentation. 
Author; Don Fudge 
Available: 

Avant-Garde Creations 

P.O. Box 30160 

Eugene, OR 97403 

or local dealers 



Name; Single Entry 

Ledger 

System: 6809 Using FLEX 
or UniFLEX, 
TRS-80 Model III 
and Color 
Computer 
Memory: 56K 
Language: Extended BASIC 
Hardware; 8" or 5W" disk 
Description: Single Entiy 
Ledger is a simple bookkeeping 
sy;5tem for tracking income 
and expenses. It is an ideal ac- 
counting system for tax pur- 
poses saving the user both 
time and money. The data files 
may contain any number of ac- 
counts or transactions. Any 
number of reports may also be 
written from comparison 
reports of the previous year to 
transactions by account 
number. 
Price: $95.00 

Includes disk and manual. 
Author; K. Orlowski 
Available: 

Universal Data Research Inc. 

Dept. A 

2457 Wehrle Drive 

Buffalo, NY 14221 



Name: Prelab Studies in 
General Organic 
and Biological 
Chemistry 

System: Apple II with 

3.3 DOS 
Memory: 48K 
Language: Applesoft 
Description: This package pro- 
vides a review of selected 
chemical concepts highlight- 
ing important ideas, tech- 
niques, and calculations en- 
countered in the laboratory. 
The programs are in a tutorial 
format, using demonstrations, 
interactive exercises, animated 
sequences, and simulations. 
Price; $550.00 (tentative) 
Includes nine disks and 
complete documentation. 

Author: Sandra L. Olmsted 

and Richard D. Olmsted 
Available: 

John Wiley & Sons, Inc. 

Eastern Distribution Center 

Order Processing 

Department 

1 Wiley Drive 

Somerset, NJ 08873 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



103 



Software Catalog (continued) 



Name; System/ASM 3A 

System: Apple II Plus 
Memory; 48K minimum. 

Language card is 

supported. 
Language: Assembly 
Hardware: Disk II required, 

Silentype printer 

optional 
Description: System/ASM 3A 
is an assembly-language devel- 
opment system that features a 
two-pass assembler, full screen 
editor, and disk-file manage- 
ment system. The system is 
easy to use but powerful 
enough to write very complex 
programs. Systein/ASM 3A is 
written in its own assembly 
language and is DOS 
3.3-compatible. 

Price; $35.00 
$5.00 for manual only 
Includes no shipping and 
handling charges. Ohio 
residents add appropriate 
sales tax. 

Available: 
The Mike Piaser Company 
15401 Maple Park Drive #11 
Maple Heights, OH 44137 



Name: Factoring Whole 

Numbers 

System; PET DOS 2. 1 
Memory: 1 6K 
Language: BASIC 
Hardware: Disk drive or 

cassette 
Description: Twelve programs 
(on six tapes or three diskettes] 
present the concepts of factor- 
ing in a carefully-designed se- 
quential preparation for frac- 
tions and algebraic expres- 
sions. A tutorial and practice 
program precedes six moti- 
vating and interactive enrich- 
ment programs. 
Price: $90.00 

Includes diskettes or tapes 

and a teacher's guide. 
Author: Joanne Benton 
Available: 

Quality Educational Designs 

P.O. Box 12486 

Portland, OR 97212 



Name: Android Attack 

System; Atari 400/800 
Memory: 16K cassette 

32K disk 
Language: Hybrid 
Hardware: Cassette or disk 

system 
Description: The nuclear re- 
actor in our top-secret under- 
ground lab is in danger of 
melting down! Only you can 
save it by manually releasing 



the coolant water. Unfor- 
tunately, there isn't time to 
disarm the security Androids 
guarding the installation, so 
you'll have to fight your way 
down. Once you've released 
the water, you've got to get 
back out before you drown! 
Andioid Attack has electric 
robots and walls, bonus points, 
and up to eight different levels 
to challenge you! 
Price: $18.95 plus $2 shipping 

(Mail order price) 
Author: John Wilson 
Available; 

Pretzelland Software 

2005 D. Whittaker Rd. 

Ypsilanti, MI 48197 

(313) 483-7358 

or local dealers 



Name: The Last One 
System: Apple II Plus 
Memory; 48K 
Language: BASIC/Machine 
Hardware: Two disk drives, 
printer optional 
Description: The Last One is a 
computer program code gener- 
ator that designs a program and 
enters flowchart-type state- 
ments in an easy-to-use menu 
style. The Last One then 
begins to code the program, 
asking the user questions 
about "where to branch," etc. 
A BASIC program is created as 
output which then can be run, 
listed, or modified like any 
other BASIC program. The 
Last One is not required to ex- 
ecute the output program. 
Price: $600.00 
Includes complete 
documentation, numerous 
sample flowcharts that will 
produce software worth 
several hundred dollars. 
Author; D.J. 'AI' Systems Ltd. 
Available; 
Krown Computing 
1282 Conference Dr. 
Scotts Valley, CA 95066 
(408) 335-3133 



Name: Assemblers 

Package I 

System: The UCSD 
p-SystemTM 

Memory; 48Kb runtime 
environment; 
64Kb development 
environment 
Language: Assembly 
Hardware: 8086, Z80, 8080, 
8085, 6502, 9900, 
6809, 68000, and 
LSI- U /PDP-11 



Description; This collection of 
native code-generating macro 
cross-assemblers allows you to 
program on the host machine 
of your choice for the object; 
machine of your choice. 
Price: $375.00 

Includes object code. 
Available: 

SofTech Microsystems, Inc. 

9494 Black Mountain Rd. 

San Diego, CA 92126 

(714) 578-6105 



Name: Galactic 

Gladiators 

System: Apple II with 
Applesoft ROM 
card, Apple II 
Plus, or Apple III 
Memory; 48K 
Hardware; Monitor and disk 

drive 
Description: Galactic Gladi- 
ators is a fast and furious com- 
puter game of alien combat for 
two players or against the com- 
puter. The creatures are rated 
for strength, endurance, speed, 
dexterity, experience, weapons, 
skill, and armor. The scenario 
permutations are as infinite as 
the Universe. 

Price: $39.95 

Includes rulebook, disk, and 

data card. 
Author: Tom Reamy 

Available: 
Strategic Simulations Inc. 
465 Fairchild Dr. 
Suite 108 

Mountain View, CA 94043 
(415) 964-1353 



Name; The Animator 

System: Apple II or Apple 

II Plus 
Memory: 48K 
Language: Applesoft/ 

Assembly 
Hardware: Disk drive 
Description; This program pro- 
duces animated 'film' strips 
that enter only key frames, 
then The Animatoz calculates 
the in-between frames. The 
key frames are easily entered 
— either visually, numerically, 
or from a library. The demo in- 
cludes a ballet sequence show- 
ing a ballerina with 12 i:ade- 
pendently moving body parts. 

Price: $51.95 

Includes 57-page manual, 

three tutorials, and a shape 

generator. 
Author: Ray Balbes 
Available: 

Balbesoftware Systems 

#6 White Plains Dr. 

St. Louis, MO 63017 

|314) 532-5377 



Name; The Apple Family 

Sing-Along 
Christmas Disk 

System: Apple II, Apple II 

Plus, Apple III 
Memory: 48K 
Language: Applesoft or 
Integer Basic 
(runs in 

emulation mode 
on Apple III) 
Hardware: Disk drive 
Description: Sixteen favorite 
carols, complete with words to 
all the verses, containing 
multiple-voices and four-part 
harmony, are pitched so you 
can sing along if you want to. 
The choice of an internal 
speaker or cassette port output 
is given. The Christmas music 
is tuneful, well arranged, and 
lots of fun to listen to. Just the 
thing to lend novelty and a 
festive background to 
Christmas parties, office par- 
ties, and Apple family get- 
togethers. 
Price; $24,50 

Includes everything needed 

to play the songs — no hard- 
ware required. 
Author; Product of the Music 

MakerTM utility from 
SubLogic 

Communications Corp. 
Available: 

Solutions Softworks 

Box 72280 

Roselle, IL 60172 

$1.50 shipping costs 

or from Apple dealers 

Name: Anova n 

System: Apple II or Apple 

II Plus 
Memory: 48K 
Language: ROM Applesoft 
Hardware: One or two disk 
drives, printer 
optional 
Description: Anova 11 performs 
up to a five-way analysis of 
variance with equal or unequal 
numbers. It can analyze ran- 
domized designs, between and 
within designs, and repeated 
measures of designs. Anova II 
can also perform an analysis of 
co-variance for all designs. The 
Anova table output tests all 
factors and interactions. 
Price: $150.00 

Includes program disk and 

backup disk, documentation, 

and binder. 
Authors; Stephen Madigan, 

Ph.D. and Virginia 

Lawrence, Ph.D. 
Available: 

Human Systems Dynamics 

9249 Reseda Blvd 

Suite 107 

Northridge, CA 91324 

(continued) 



104 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



Software Catalog 



(continued) 



Name: UniFLEX 

System: Gimix 6809 
Winchester 
Systems 
Memory: 128K minimum 
Language: Available: BASIC, 
Pascal, Assembler, 
FORTRAN 77, C 
Hardware: 2MHZ 6809 CPU 
with memory, 
disk controllers, 
19MB 514" 
Winchester 
Description: UniFLEX is a true 
multi-tasking, multi-user 
operating system. Each user 
communicates with the 
system through a terminal and 
may execute any of the 
available system programs. 
This implies that one user may 
be running the text editor 
while another is running 
BASIC while still another is 
running the C compiler. Not 
only may different users run 
different programs simultane- 
ously, but one user may be 
running several programs at a 
time. 

Price: $550.00 
Includes UniFLEX Operating 
System, documentation. 

Author: Technical Systems 

Consultants, Inc. 
Available: 

Gimix Inc. 

1337 W. 37th St. 

Chicago, IL 60609 

[312| 927-5510 

Price: $99.95/Sinclair tape 

$129.95/Apple/Atari disk 

$129.95/Atari tape 

Includes 34 pages of 

documentation. 
Author: Bob Nadler 
Available: 

F/22 Press 

P.O. Box 141 

Leonia, NJ 07605 



Name: Lovers or 
Stiangeis 

System: Apple II 
Memory: 48K 
Language: Applesoft 
Hardware: One disk drive 
Description: Loveis or 
StzangeTS is a computer game 
with a serious side. It is a com- 
patiblity evaluator that tells 
two people how likely they are 
to have a successful relation- 
ship. A couple's likes and 
dislikes, philosophies, and 
lifestyles in seven major areas 
of compatibility are explored. 



Price: $29.95 

Includes program disk and 

written instructions. 
Author: Stanley Crane 
Available: 

Alpine Software, Inc. 

2120 Academy Circle, Suite E 

Colorado Springs, CO 80909 

(303) 591-9874 



Name: 



System: 

Memory: 

Language: 

Hardware: 



The Football 
Comput-Stat 

Apple II, IBM PC, 
Radio Shack MIH 
48K 
BASIC 

One disk drive, 
printer optional 
Description: Compu-Stat con- 
tains programs and related data 
for the analysis of pro- 
football's regular season — 
both point-spread records and 
the underlying box-score sta- 
tistics. It performs analyses for 
the 1981 and 1982 regular sea- 
sons. A related program prod- 
uct, Tally Sheet, keeps a run- 
ning tally on your predictions. 
Price: $100 - $3500 depending 
on programs and equipment 
ordered. 

Includes user manual, 
program diskette, and 
security chip. 
Author: Dr. John Page 
Available: 
Interactive Sports Systems 
P.O. Box 15952 
New Orleans, LA 70175 



Name: 



System: 
Memory: 
Language: 
Hardware: 



Elements of 
Mathematics 

Apple II 
48K 
BASIC 

One disk drive 
Description: This program was 
developed to assist students in 
adding fractions, reducing frac- 
tions, and adding fractions 
with unlike denominators. 
Materials were developed and 
tested by the authors before be- 
ing published. 
Price: $90.00 
Author: Ray E. Zubler 

Susan Sarapata 
Available: 
Electronic Courseware 

Systems, Inc. 
P.O. Box 2374, Station A 
Champaign, IL 61820 
(217] 359-7099 
or computer retail stores and 
book stores 

(continued) 



}IIM's eating 
your Apple? 



Find out with Apple-Cillin II™ 

If you use your Apple for your business or 
profession, you probably rely on it to save you 
time and money You can't afford to guess 
whetfier it is working properly or not Now you 
don't have to guess. Now you can find out 
with Apple-Cillin II. 

Apple-Cillin II is the comprehensive diagnostic 
system developed by XPS to check the 
performance of your Apple II computer system. 
Apple-Cillin II contains 21 menu driven utilities 
including tests for RAM memory ROM 
memory, Language Cards, Memory Cards, 
DISK system, Drive Speed, Keyboard, Printer, 
CPU, Peripherals, Tape Ports, Monitors and 
more. These tests will thoroughly test the 
operation of your Apple, and either identify a 
specific problem area or give your system a 
clean bill of health. You can even log the test 
results to your printer for a permanent record. 

Apple-Cillin II works with any 48K Apple system 
equipped with one or more disk drives. 

To order Apple-Cillin II - and to receive 
information about our other products - Call 
XPS Toll-free: 1-800-233-7512. In Pennsylania: 
1-717-243-5373. 

Apple-Cillin II: $49.95. PA residents add 6% 
State Sales Tax. 



XPS 



XPS, Inc. 

323 York H02d 

Caflisk Pennsylvania 1/013 

800-233-7512 

/1/-243-53/'3 



4ppte II IS a trademark o' 4ppte CompoTef 'nc 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



105 



TIKED OF ALL THE 
^^EXCEPTFOR..."5? 

WRH THE NEW PRINTOGRAPHER 
GRAPHICS PRINTING SYSTEM. 
WE'VE GOT YOU COVERED! 




PRICE: $49.95 

(CollfornlO'RcsklenB odd 6% soles Kix.> 



The PRINTOGRAPHER is designed ro fill oil of your graphic printing 
needs; wjfhouf having to worry obour running info the problem of if 
almost working, "except on your printer", or "except for the lock of 
Ihoir poticulor feature", Whether you hove a daisy wheel of dot matrix 
, ptlnter, the stondord vetsion "of PWNTOGRAPHER works on ony printer 
and intetfeice" comblnotioh with graphics capabilities. In many cases, 
this Includes printeis you may not even hove thought could print 
graphics. . 

Just o FEW of the possible printers include-. EPSON. PAPER TIGER, ANADEX, 
NEC OlADLO, QUME, MPt, SILENTYPE. OKIDATA. MAUBU, interlace cords 
Include: APPLE, SSM, CCS, MTN COMP. CPS, MPI. GRAPPLER. TYAMC 
PROMETHEUS and more! 

In addition to versatile print options (easy cropping, vorioble mognifi- 
cotibns, fiormol/reverse inking, vertical/horizontal format, etc.) 
PRIHTOGRAPHER offers such unique features as the obility to print 
pictures directly from disk (without loading o file), spooling via our 
DOUDiiriME PRINTER pockoge, or sending pictures over o phone \ine 
using ASCII EXPRESS. You con even put graphics in your text documents 
with our text editor sofiwore, THE CORRESPONDENT As if thotwasn't 
enoi,%h, we've mode it eosy to put itie PRIMTOGRAPHER rounnes nghr 
in your own progroms to do Hi-Res printing immediately dunng their 
operation, without hoving to save screen images to disKl 

We olsG know you see a lot of advertising these days for o truly over- 
wheknihg volume of software oil cloiming to be the best so we moke 
this simple guotontee: 

IF YOV CAN RND A BETTER PACKAGE THAN (OR ARE AT All UNSATISnED 
WITH) THE PRINTOGRAPHER WITHIN 30 DAYS OF PURCHASE, SIMPLY 
RETURN THE PACKAGE FOR A COMPLHE REFUND. NO QUESTIONS 
ASKEDI 

For more informofion, see your local deoler, or write SOUTHWESTERN 
DATA SYSTEMSfor Q free cotalog If your dealer is out of stock, we con 
ship PWNTOGRAPHER to him within 24 hours of o coll ro our offices. 

REMEMBER.' WITH PRINTOGRAPHER. YOU'RE PICTURE PERFECT! 



Software Catalog (continued) 



IOT'm-E Woodside Avenue • Sontee, CoHfornio 92071 
Telephone: 7 1 4/562-3670 



Name: Basic Aid 
System: TRS-80 Color 

Computer 
Memory: 16K - 64K 
Language: 6809 Machine 

Language 
Hardware: ROMPAK 
Description: Basic Aid is a 
utility program to help and 
assist Color BASIC and Ex- 
tended BASIC users. Some of 
the features are: automatic line 
numbering, program merging, 
and moving program seg- 
ments. It comes with a plastic 
keyboard overlay that contains 
most of Extended Color 
BASIC'S commands. 
Price: $34.95 

Includes detailed instruction 

manual, plastic keyboard 

overlay. 
Author: Eigen Systems 
Available: 

Spectrum Projects 

93-1586 Drive 

Woodhaven, NY 11421 

Name: S-C Macro Cross 

Assemblers 6800, 
6809, and Z-80 

System: Apple II or Apple 

II Plus 
Memory: 48K (RAM card 

version included) 
Language: Machine 
Hardware: Disk drive 
Description: You can easily 
develop programs for 6800, 
6809, or Z-80 computers with 
powerful macros, conditional 
assembly, 20 directives, and 29 
commands (including a power- 
ful EDIT command with 15 
subcommands). It allows very 
fast cycles of modification, re- 
assembly, and testing. 
Price: $110.00 each. 

Registered owners of the S-C 

Macro Assembler pay $32.50 

each. 

Includes diskette with 

regular and RAM card 

versions, 100 -i- -page 

manual. 
Available: 

S-C Software Corporation 

P.O. Box 280300 

2331 Gus Thomasson 

Suite 125 

Dallas, TX 75228 

(214) 324-2050 

Name: GL-PLUS 

System: Apple in 

Memory: 128K 

Language: Business BASIC 

Hardware: 132-column 

printer and either 
second diskette 
drive or hard 
drive . 

Description: GL-PLUS is an 

extremely flexible and easy to 



operate general ledger with 
built in receivables and 
payables. Reports include 
general ledger, month's jour- 
nal, balance sheet, income 
statement, aged receivables 
and payables, receivable and 
payable detail, and more! 
Price: $495.00 

Includes operator's manual, 

programs, and sample 

company data. 
Author: Dan Sargent 
Available: 

Great Divide Software 

8060 W. Woodard Dr. 

Lakewood, CO 80227 

Name: Borg 

System: Apple II or Apple 

II Plus 
Memory: 48K 
Language: Assembly 
Hardware: One disk drive, 

paddle or joystick 
Description: Deranged Grud 
Terrorizes Countryside! Pro- 
tected by Borg, the invincible 
Drageroo, a notorious band of 
dragons, the infamous Grud 
has surrounded his hide-out 
with electrified mazes. Can no 
one crack the code and rid us of 
this menace? 
Price: $29.95 
Author: Dan Thompson 
Available: 

Sirius Software, Inc. 

10364 Rockingham Dr. 

Sacramento, CA 95827 

|916| 366-1195 

Name: D.F.T 

System: TRS-80 Color 

Computer 
Memory: 16K 
Language: Machine 
Hardware: Cassette recorder 
Description: This terminal 
program allows you to down- 
load any type of program — 
BASIC or machine language — 
or ASCII with no conversion. It 
allows transfer of programs 
between TRS-80 Mod I's, Mod 
Ill's, and the Color Computer. 

Price: $19.95 

Includes one tape. 
Author: Bob Withers 

Available: 
Computer Shack 
1691 Eason 
Pontiac, MI 48054 

Collection: The softwaie 
listing foi Jinsam Executive 
(52:116) fiom fINI Micro- 
systems, Inc., should have 
lead 32K foi CBM w/8050, 
and 128K IBM PC for BASIC 
and machine language. It is 
available fiom the company 
and paiticipating dealers. 

/AJCftO 



106 



MICRO - The 6502/6809 Journal 



No. 55 - December 1S82 



iAICftO 

Hardware Catalog 



Name: Guild Computet 

Rack 

System: Apple II 
Description: The Guild Rack 
comes in a choice of beautifully 
finished mahogany or ash. No 
assembly is required. It fits 
comfortably over the Apple n 
keyboard, holds one or two 
disk drives, and easily supports 
a monitor on top. 
Price: $54.95 - ash 

$69.95 - mahogany 
Available: 

Guild Computer Rack 

225 West Grand Street 

Elizabeth, NJ 07202 

(201) 351-3002 



Name: Disk Interface/ 
ROMpak 
Extender 

System: Color Computer 
Memory: 4K and up 
Hardware: Three-foot 

extender cable 
Description: The Disk Intei- 
face/ ROMpak Extender is a 
40-pin ribbon cable that plugs 
into the ROMpak port and ter- 
minates three feet later with a 
40-pin female connector to 
connect ROMpaks and the 
disk interface. Gold-plated 
contacts eliminate corrosion. 
Price: $29.95 plus $1 for S/H 
Includes male and female 
connector, three feet of 
40-conductor cable. 
Available: 
Spectrum Projects 
93 - 1586 Drive 
Woodhaven, NY 11421 
(212) 441-2807 Voice 
(212) 441-3755 Computer 



Name: Versaclock 
System: TRS-80 Color 

Computer 
Memory: 4K and up 
Language: BASIC or 

Extended BASIC 
Description: The Versaclock is 
a full-featured, highly accurate 
hardware clock for the Color 
Computer. It provides time of 
day, date, month, and year 
with automatic daylight sav- 
ings time and leap year com- 
pensation. The clock is battery 
backed-up to allow removal 
from computer without loss of 
data. The clock also contains 
50 bytes of battery backed-up 
RAM for general purpose per- 



manent storage. The many 
software options include inter- 
rup handling and 12/24 hour 
formats. 
Price: $99.95 
Includes Versaclock 
cartridge, full instructions. 
Available: 
Maple Leaf Systems 
Box 2190 

Station "C", Downsview 
Ontario, Canada M2N-2S9 



Name: Color Graphic 

Printer (26-1192) 

System: Compatible with 
TRS-80 Models I, 
n, m, and Model 
16 computers, and 
DT-I Data 
Terminal 
Description; The TRS-80 Col- 
or Graphic Printer can create 
anything from doodles to four- 
color pie charts, as well as 
more standard text and 
graphcis. Ninety-six ASCII 
characters are available in four 
colors (red, blue, gieen, black) . 
Special graphic commands in- 
clude backspace, reverse line 
feed, change colors, change 
line type (solid or 15 types of 
dashed lines), change print 
direction (normal left-to-right, 
top-to-bottom, upside down or 
bottom-to-top), move without 
drawing, draw between points 
and draw axes. The RS232-C 
serial interface is compatible 
with Radio Shack TRS-80 Col- 
or Computers. 
Price: $249.95 
Available: 
Radio Shack Stores, 
computer centers, and 
participating dealers 

Name: K-Byte Stick 
Stand with 
Fastball Easy-Grip 
Control Knob. 

Description: K-Bytes unique 
Stick Stand with the Fastball 
Easy-Giip Control Knob 
reduces hand and wrist fatigue 
and frees one hand for a more 
skillful operation of the 
firebutton. This combination 
allows players to increase their 
physical dexterity and achieve 
higher scores. By just snapping 
the fastball onto the joystick 
and then snapping the joystick 
into the stick stand, the player 



is all set for precision arcade 

action. 

Price: $6.99 suggested retail 

Includes base stand and 

fastball knob. 
Available: 

John Mathias 

K-ByteTM 

Div. of Kay Enterprises Co. 

P.O. Box 456 

1705 Austin 

Troy, MI 48099 

1313) 524-9878 

or your local computer 

retailer 



Name: Fast Load — Fast 
Save Cassette 
System 

System: OSI-CIPor 
Superboard n 
Description: Load BASIC or 
machine-language programs in 
your 8K memory in less than 
30 seconds at a speed of 2400 
bits per second input/output 
data rate. Customer supplies 
own tape recorder. The unit in- 
cludes a 2K RAM fully decoded 
which may be used to hold 
machine-language programs. 
Unit plugs directly into your 
CIP or Superboard n. 
Price: $69.95 fully assembled 

$59.95 with cashier's check 

or money order. 

$62.95 kit 

$52.95 with cashier's check 

or money order. 

Includes printed circuit 

board, cassette tape program, 

self-contained R/W memory, 

connectors, and user's 

manual. 
Available: 

Wotd-Com 

P.O. Box 1122-28 

Park Plaza Offices 

303 Williams Ave. 

Huntsville, AL 35801 



Name: Pro-Guard 8" 

Floppy Controller 

System: Apple in 
Memory: Up to 2.2 

megabytes 
Language: SOS, DOS 3.3, 

Pascal 
Hardware: Controls two 8" 

Shugart- 

compatible drives 
Description: This 8" floppy 
controller resides in-line be- 
tween Apple in and the drive 
system and connects to slot 2 



via SVA's innovative Smart- 
Cable. 

Price: $695.00 
Available: 
SVA Sorrento Valley 
Associates, Inc. 
11722 Sorrento Valley Rd. 
San Diego, CA 92121 
Apple dealers, Micro-D, 
Micro House, U.S. Micro 
Sales 



Name: Ramex 128 

System: Apple II or Apple 

nPlus 
Memory: 48K 
Description: This 128K RAM 
expansion board includes disk- 
emulation software that fea- 
tures super-fast mounts and 
dumps from card to disk (20-25 
seconds for an entire 128K). 
Also available for VisiCalc is 
super expander software that 
gives the same super-fast 
loading and saves of VisiCalc 
files (I36K in 20 seconds). 
Price: $499.00 

Includes disk emulation 

software and memory 

management. 
Available: 

Omega Microware, Inc. 

222 S. Riverside Plaza 

Chicago, IL 60606 



Name: Multi-Port 232 

Description: The Multi-Port 
232 is a 4- or 8-port multidrop 
data router that allows merg- 
ing or splitting of RS232, fiber 
optic, and current loop in any 
source/destination combina- 
tion. It provides local network- 
ing for word processors, 
printers, modems, video dis- 
plays, computers, teletypes, 
and instruments. 
Price: $435.00 - 4-port 
VISA/Master Charge 
Includes nine user-selectable 
preprogrammed routes. 

Available: 
Park Computer Corporation 
Box 13010 
Minneapolis, MN 55414 



iiMCftO 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



107 



/MCQO 

6809 Bibliography 



Dr. William R. Dial 
438 Rosiyn Avenue 
Akron, OH 44320 



86. Color Computer News, Issue No. 11 (August, 1982) 

Ostrom, Steven M., "Graphics and Animation for the Color 

Coinputer," pg. 30-42. 
A tutorial for the TRS-80 Color Computer graphics with a 
number of demo routines. 

Dawson, Don, "Color Yahtzee," pg. 44-47. 
A game for the 6809-based Color Computer. 

Phelps, Andrew, "Comment Comer," pg. 49-50. 
A tutorial on RAM hooks, places where the program jumps, 
and which then jump elsewhere in memory. 

McClenahan, Shawn A., "A Real Keyboard for the Color Com- 
puter," pg. 55-60. 
A hardware project for the Color Computer. 

Field, E.C., "Electro-Sketch," pg. 67-69. 
A graphics program for the 6809-based Color Computer 
which allows one to draw simple schematics and save or 
print them. 

Lee, Paul, "Educating Your Preschooler with the Color Com- 
puter," pg. 71. 
A simple teaching program for young children using the Col- 
or Computer. 

Weiss, Arnold, "Cryptogram," pg. 72-76. 
A program to present cryptograms on the TRS-80 Color Com- 
puter screen or to make printed copies. 

Harper, Jeff, "Word Processor," pg. 77-79. 
A word-processor program for the 16K or 32K Extended 
BASIC Color Computer. 

Foster, Robert D., "Monitor," pg. 81-82. 
A simple monitor to allow one to see how the Color Com- 
puter actually works. 

Tenny, Ralph, "Extra Tricks with Color Scripsit," pg. 84-85. 
An accessory listing to aid in using Color Scripsit. 

Aldrich, F.C., "Magic Square," pg. 87-89. 
A contest-winning listing for the 6809-based Color Computer. 

87. '68' Micro Journal, 4, Issue 8 (August, 1982) 

Anderson, Ronald W., "FLEX User Notes," pg. 11-14. 

Miscellaneous notes on FLEX for the 6809-based systems. In- 
cludes a multiply program in assembly language. 
Nay, Robert L., "COLOR User Notes," pg. 14-16. 

Discussion of some new items for the 6809-based Color 

Computer. 
Abrams, Clayton W., "F-Mate," pg. 16-17. 

A utilities package for the TRS-80 Color Computer. 
Distefano, Tony, "Color Clinic," pg. 17-18, 

Discussion of hardware modifications for the TRS-80 Color 

Computer. 
Commo, Norm, " 'C User Notes," pg. 19-24. 

Discussion of major C compilers for 6809 systems. 
Watson, Ernest Steve, "Home Accounting Program — Part II," 
pg. 25-28. 

A program for 6809 systems. 
Hartman, William, "Diskfix9," pg. 29-36. 

A utility for 6809-based systems. 

88. The Rainbow, 2, No. 2 (August, 1982) 

Nolan, Bill, "Let's Call JO YIN To Learn ROM Call 

Technique," pg. 8. 
A short program illustrating how to call one of the built-in 
ROM routines in the fRS-80 Color Computer. 

Lishnak, Pat, "Sort Numeric Arrays Fast with Machine 

Language," pg. 9. 
A bubble sort technique for the Color Computer. 



Boston, William, "Here's An Easy Way to Place Orders by 
Mail," pg. 19-20. 

An order-writing program for the Color Computer. 
Lewandowski, Dennis S., "The Assembly Corner," pg. 22-25. 

A tutorial on 6809 assembly-language programming. 
Clements, Bill, "Rockin' Through the ROM," pg. 29-30. 

Documenting the ROM routines of the TRS-80 Color 

Computer. 
Preble, Laurence D., "FLEX System is Powerful Addition to 
World of 80C," pg. 32-33. 

All about the FLEX system for the 6809 micro. 
Scerbo, Fred B., "Alpine Aliens," pg. 34-37. 

A game for the Color Computer. 
Blyn, Steve, "Good Reinforcement Means You Can't Frown at 
Me!", pg. 41-46. 

Tips and demo program for educational use. 

Mir, Jorge, "Now, Make Your Own Adventure with 

ADVMAKER," pg. 47-53. 
A program designed to simplify the programming of Adven- 
tures written for the Color Computer. 

Nolan, Bill, "Dragons Are Nice Folks, Too... Almost All 1,440 

of Them," pg. 62-69. 
The program "Dragon Roller" will assist with the chore of 
devising a dragon for your dungeon program. 

89. Byte, 7, No. 8 (August, 1982) 

Williams, Gregg, "LOGO for the Apple II, the T1-99/4A, and 
the TRS-80 Color Computer," pg. 230-290. 

Discussion of LOGO for several micros, including the 

6809-based Color Computer. 

90. The Target (March/ April, 1982) 

Staff, "News", pg. 1. 
An assembly which converts an AIM 65 into a 6809-based 
computer. 

91. Compute! 4, No. 8 (August, 1982) 

Chastain, Linton S., "Energy Monitor," pg. 116-118, 
This program for the TRS-80 Color Computer will show you 
the effects of home energy conservation. 

92. Microcomputing, 6, No. 9 (September, 1982) 

Avery, Mike, "Prime Number Nonsense," pg. 16. 
Comments on the 6809 versus the 6502, Z-80, or 6800 
microprocessors. 

93. Color Computer News (August, 1982) 

Sias, Bill, "REMarks," pg. 6-7. 

Announcement of the 6809 Achievement Award being given 

monthly to the most innovative use for a 6809. 
Gray, Don, "Number Conversion," pg, 7-8. 

Three listings for number conversion programs for the 

6809-based TRS-80 Color Computer. 
Anon, "Color Computer Bulletin Board System," pg. 11. 

A BBS for the Color Computer is up in the Toronto area. Call 

(416) 494-7001 evenings and weekends. 
Donahue, Mike, "Cross-Reference Generator," pg. 15-25. 

A utility for the 6809-based TRS-80 Color Computer. 
Grady, Larry, "Review of Master Control," pg. 29-33. 

Problems encountered with the program "Master Control" 

and some reprogrammed sections to alleviate difficulties. 
Graham, Randy W., "Modems, Terminals, and Bulletin 
Boards," pg. 35-38. 

Using the Color Computer in telecommunications. MLtfory- 



108 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



COMMODORE 64 



• 



The Commodore 64 is a 6510-based color- 
and-sound computer that connects to a color 
TV via an RF modulator. 64K RAM iS|Standard, 
with 39K of it available for BASIC programs. 

Graphics 

3 character modes 
2 bit-map modes 
sprite graphics 

Sound 

4 programmable voices 

attack, sustain, decay, and release 
output compatible with stereos 

Z-80 option for CP/M 

RS-232, expansion/cartridge, parallel, cassette 

and controller interfaces 



Commodore 64 Memory Map 

Address Function 

$00-$FF Page zero, operating system storage, pointers, floating point 

accumulators, flags, etc. 

$100-$1FF Microprocessor system stack 

$100-$10A Floating-to-string work area 

$100-$13E Tape input error log 

$200-$2FF Operating system buffers, tables, vectors, I/O flags, keyboard 

handling 

$300-$3FF Vectors, tape i/O 

$400-$7FF Normally video memory, sprite data pointers, etc. 

$800-$9FFF Normally BASIC program space 

$8000-$9FFF VSP Cartridge ROM 

$AOOO-$BFFF BASIC ROM 

$COOO-$CFFF RAM 

$DOOO-$DFFF I/O devices and color RAM or character-generator ROM 

$EOOO-$FFFF Kernal ROM 



Control Port 1 



Pin 


Function 


1 


JOYAO 


2 


J0YA1 


3 


J0YA2 


4 


J0YA3 


5 


POT AY 


6 


BUTTON A/LP 


7 


-(■5V 


8 


GND 


9 


POT AX 



Control Port 2 


Pin 


Function 


1 


JOYBO 


2 


JOYB1 


3 


J0YB2 


.4 


J0YB3 


5 


POT BY 


6 


BUTTON B 


7 


+ 5W 


a 


GND 


9 


POTBX 



Cartridge Expansion Slot 



CO 




Audio/Video 



Pin 


Function 


1 
2 
3 
4 
5 


LUMINANCE 
GND 

AUDIO OUT 
VIDEO OUT 
AUDIO IN 



Serial I/O 



Pin 


Function 


1 
2 
. 3 
4 
5 
6 


SERIAL SRQIN 

GND 

SERIAL ATN IN/OUT 

SERIAL CLK IN/OUT 

SERIAL DATA IN/OUT 

RESET 




User I/O 



Ptn 


Function 


1 


GND 


2 


-I-5V 


3 


RESET 


4 


CNT1 


5 


SP1 


6 


CNT2 


7 


SP2 


8 


PC2 


9 


SER. ATN IN 


10 


9 VAC 


11 


9 VAC 


12 


GND 



Ptn 


Function 


A 


GND 


B 


FLAG2 


C . 


PBO 


D 


PB1 


E 


PB2 


F 


PB3 


H 


PB4 


J 


PBS 


K 


PB6 


L 


PB7 


M 


PA2 


N 


GND 



Pin 


Function 


1 


GND 


2 


-H5V 


3 


-^5V 


4 


IRQ 


5 


CRW 


6 ■ ; ■ "■ 


Dot Clock 


7 


i/01 


8 


GAME 


9 V ■■ 


EXROM 


10 


+ U02 


11 


ROML 


12 


BA 


13 


DMA 


14 


D7 


15 


D6 


16 


D5 


17 


D4 


18 


D3 


19 


D2 


20 


D1 


21 


DO 


22 


GND 



Pin 


Function 


A 


GND 


B 


ROMH 


C 


RESET 


D 


NMI 


E 


S02 


F 


A15 


H 


A14 


J . 


A13 


K : 


A12 


L 


A11 


M 


A10 


N 


A9 


P 


AS 


R 


A7 


S 


A6 


T 


A5 


U 


A4 


V 


A3 


w 


A2 


X 


A1 


Y , 


AO 


■ Z. "■ ^ 


GND 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 



ABCDEFHJKLMNPRSTUVWXYZ 



Cassette 


Pin 


Function 


A-t , 


GND 


B-2 


+ 5V 


C-3 


CASSETTE MOTOR 


D-4 


CASSETTE READ 


E-5 


CASSETTE WRITE 


F-6 


CASSETTE SENSE 



1 


2 


3 


4 


5 

■ 


6 

■ 





A B C D E F 



1 


2 


3 


4 

■ 


5 


6 

■ 


7 


8 


9 

■ 


10 11 


12 





ABCDEFHJKLMN 



IMCRO" Data Sheet #11 



COMMODORE 64 



o 

E 

£ 

2 

c 
o 
o 

o 
u 

a 
t 
a 



> 

0) 
0) 



3 
o 



O 
DC 



at 



0) 

•a mO 

■§-11 
<u iS^- — ■ 



1^ 

; 0) T3 
ra <D 

l-O t 

O 

oO 



"O 

c 
. o 
1 " 
'O 
. DC . 



Q K^o^ B 



ro 



OO 

■O -D 

Si 
CO 



0} 
0) O) 



i: ,^ = 3 >,- 



Eo^a 



S 

■a 

> 

(O 
(O . 
tn 

(O 

W 
O 

S - 

•E 
1 



o 

CO II 



CO — f 1 — 



CO a) 

c Q- 

o ~ 



<3)DC 

_C0 — 

— c 
)0-5 
' C.2 

~ =S o" 

"■go 

-ii- ^ CO 
C O Q. 
Q. CD E 

<C -9 o 
o o o 



§■.9 a: 

Q. o 
II .!» c 

'" T3 O I 
l: § O • 

« ™5 



cr 
o 



o)3 



O! 



CO ■" 



(U O C 
■- CO ,. 

^^ A 

. _ <S V 01 

aj u (D t oj « 

£ 'H m o '^ "E 
a Q. CO is Q. Q. 
CO CO DC !i CO w 



C31 

So 

-9 o 
6 " 



Q.O 

CO m 



O - C>J CT) ■g''g' 

o o o o ._ ._ 
o o o o ^ ° 

OOOOOOi-'-i-i-i-i-.-i- 
•D-D-D-D.9.y^-2°°OPOO 

cccc — — oooooooo 

33333300000000 

2222EEo--cMCTi-i/5cDt^ 

2 2 S S B £££££'^£'^'^ 
o o o o c z c H H H n ■£ c ■£ 

CD CO CO CO Q.Q.Q.CD.Q.Q.Q.Q.Q.Q. 

mmmmcocococococococococo 



5, -"f 9 
5 1^ t^ 



t^ CO CN T- o 



m 

<Si 

m 



•>i-inco^-cDcnoi-cNm'>i-incD^-cDcnOT-c\jc:0'>a- 
T-^t^T-^t^T-^t^aoaoaoa:>ao<oao<oaoao<T>(ji(jiOiOi 

(MCMCNCNCNCMCNCMCMCNCNCNCNCMCMCMCNCMCNCNCN 

cocncococococococococococococococococococo 
loioinmioioioioioinioioioioioioinmininir) 











0) 












O CO 


-^ 






' byte 
h byte 
low byte 




J3 

'c 




c 
o 
II 








3 output 1 = 
freq. 1 =on 
= start relea 


o 
o 






Ifl 




1 




■- 


o 


c 
o 

II 




S-nui 
0) T ■— 






1 1^ 








E c 
^ o 


II 


o 


O CO 
CO • CO 


500 


1 

Q 




ency control 
ency control 
waveform wi( 




5 

£ 
o 

1 


0) 

m 

O) 


^1' 
> ■— 

iE 

'^ CO 


E 
o 

1 


E 
o 

1 

CO 


o 

CO 

o 

0) 

J3 
CO 
CO 


modulate osc. 1 with o 
vonize osc. 1 with osc 
bit: 1 = start att/dec/su 


rator 1 : attac 
;ycle duration 
ycie (juration 


s 

CD 

s 


c 


1: Frequ 
1: Frequ 
1: Pulse 


^ 


0! i: 
i2 c 
3 O 
Q-O 


E 5 

O oj 


8 

CO 

en 


a> 

CO 


II 


ope gene 
t attack c 
t decay c 


c 




(u <u 0) 


CO 


o 


(U 


o o 


o 


o 




.E i,co 


1^1 


g 


o o o 


3 


o 


o 


s ^ 


a> 


a> 


m 






'o o o 


C 


'n 


n 


m (U 


(U 


(U 


fi^ 


cz (a ta 


■o 
c 

3 


u. 


>>>3>>COCOCOCOI-DCCOOUJCOCO: 
























O 
























(0 
























T- 


S 




•^ 


O 














t 9 




s 




r^ 


CO 




t^ CD 


in 


•"I- 


CO 


CM 1- O 


ri CO 


<o 
























to 
























O 
























S 


• 


c\j m ■* 


in 




CD 












t^ 




t^ t^ t^ 


t^ 




r^ 












t^ 






CN CN <N 


CN 




C\J 












C\J 






■ST •>5- -^ 


•>5- 




•^ 












•^ 




o 


in m in 


in 




in 












in 



I 



o 
X 



o 
Q 



<CDOQuju.Oi-c\icotincDr^cocn<CDODLU 

T-i-i-T-i-.,-CMCNCMCNCNCMCMCNCNCJC\lC\lCac\ICSi 

000000000000000000000 
QQQQQQQQQQQQQQQQQDQQQ 



O ■>- CvJ CO ■^ 
K O O O O O 

I Q Q Q Q Q 



in 
o 

Q 



a 

^^ 
10 

w 
« 

o 



(O 

to 
O 

S 



"- DC 

m ^ 
■Sail II 



3 
o-t: 



c 



I o _ ^^ 

I t; c CO to 



3 O 0) ■- 

o — 



in 

CD 



. m : 



S CD .;_■ CD 






11 

in S ^ 
T3 CO 

2mm 
LU *= -i^ 
QC "53 CD 
< CO CO 
T CO CO 

r; CD CO 

y 00 



o 
o 

o 
o 
Et: 

11 

OO 



*» o 

S >• 



E 

1 
o 



o -^ c\j CO 'I- in CO 



O 

1 

c 

5 

S 

« 
•c 

« 



o 
« 

> 

<o 
10 
<o 

to 
O 



2 CO 



m CO 



M (0 



CO (0 
P O 



CO 


CO 


CO 


CO 














0-0.0-0. 



CO CO CO 

000 

Q. O. O. 



X>-X>-X>-X>-X>-X>-X>-X>- 



o ■>- 
0) 0) 



a a 
00 CO 



T- CM 



Q. a 

CO CO 



CN CO 



Q. a 

CO CO 



CO -^ 



Q. a 

CO CO 



■^ m 



CO CO 



in CD 



CDt-t- „ 
(D (D Q> <D 



o. a 

CO CO 



a Q. a Q. 

CO CO CO CO 



.2 

CO 

CD CD 
CD 

CM 11 

CO " 

m T- 

a ax 

m _ _ (D 

CJ) CD — 

Sap 
o E o 

C O (D 

o .- -o 
O I" c 

y CO X 

> DC LU 



CN 1 



-=: ■?;-;; CO 



O 
n O 
CO O 
C i_ 
CD CD 

"O 

II O 

o 

Q. CO 

cQ m 



O 

DC 



P2 

IIS. a 

CO 



.-.S O 



Q-S o 

.« Q.-^ 
T3 ..1. CD 
„ O 3 

X -D nJ 

£>. > 

5 O CD 

2r « 

in O 2 

a; o CD 

■^ CO .tr 

(U E CD 
CO CO DC 



CO 

c 

CD 



a 

CO 

E 



0) 



CO CO .^ 

o o '^ 

0.0... 
X >- -5? ■- 

.c .c ^ a) 
o o >,cc 

« ra - -= 

Q. o 

c c: CO i: 

•c -c :: , , 3 
gi gi ay c^ 
_i _i CO > 3 



_ (D ■ 

I- a, 



s^ ir- 



w- E 



CO ^ 
CO p 
>- o 
< o 

ll 



00 p 

CO I 

o o 

0) o 

0) CD 

CO -"I- 



o "^ 

o S ^ 

"43 O CD 

9 oB 
o X °^ 

-OCM- 
X-O^ 

2 go 

O 0) >, 

■ J^ ^ ° 

" o E 
£ CO 0) 
o 0) 5 

CO CO > 



t^ CD in ■^ CO CN 



CD 

r^ in -^ CO 



CD<3JO-'-CNCO'^inCDt^CO<320-'-CNCO'>1-in 

■^•<rinminininininininincDCDCDCDCDCD 

CMCNCNCNCMCNCMCNCNCNCNCMCMCMCMCNCMCN 

cocococococococococococococococococo 
inininminmininininininininininmin 



CD r^ CD en o 

CD CD CD CD t^ 
CM CM CN CN CM 
CO CO CO CO CO 

in in in in in 



1- CM 
t^ (^ 

CM CM 
CO CO 

in in 



O 1- 

>S o o 

• o o 

..X o o 



o-'-cNco'^incDt^coc3)<a30Quju.o->- 

K OQOOOOOOOOOOOOOOi-i- 

S 000000000000000000 
I DQQQQQQQQQ QQQQQQ Q Q 



CM CO TJ- in CD 

00000 
Q Q Q Q Q 



o o 



JMCftO" Data Sheet #11 



NEW SOFTWARE 

for TRS 80 Model III 

and the Color Computer 



■ Church Contribution System 

designed to simplify and facilitate the tedi- 
ous chore of recording envelopes. Provides a 
variety of reports. Maintains its own data- 
fiies. Only $150 

■ Data Base IManager 

designed to help organize all your data and pro- 
vide you with meaningful reports. Add or delete 
any information. New files can be created and 
old information transferred. Only $150 

■ Single Entry Ledger 

designed as an uncomplicated control of 
finances for home or small business. Add, de- 
lete, edit at any time. Compatible with 
DBM. Only $95 

Write or phone for complete software price list. 



Advertiser's Index 



UNIVERSAL 

DATA 
.\X RESEARCH 





VISA' 



Dept. Ml 2 
2457 Wehrle Drive 
Amherst, NY 14221 
716/631-3011 



1 



SeaFORTH for the Apple computer 

Is a consistent structured operating system providing the 
advanced programmer with the tool to easily develop 
programs from machine language to high level compiled 
applications. With SeaFORTH. the edit-compile-execute- 
edit cycle is measured in seconds, not minutes. 

The integrated SeaFORTH package includes: 

• Editor 

• Disc I/O 

• Assembler 

• Hi-res Graphics 

• Transcendental Floating Point 

• Command Line Input with Editing 

• Detailed I SO Page Technical Manual with 

Complete Source Listing! 

Implemented as a true incremental compiler, SeaFORTH 
generates machine code, not interpreted address lists. 
SeaFORTH's direct-threaded-subroutine implementation 
executes faster than Interpreted address-list versions. 

Apple SeaFORTH requires a 48K Apple )( -f , with DOS 
3.3. Manual and copyable disk are available for only 
$100.00 

Compatible SeaFORTH for the AIM requires a terminal 
and is only available in EPROMs. Manual and EPROMs 
$150.00 

Manuals available, separately, for only $30.00 

All prices include UPS shipping. 

VISA or MASTER CHARGE welcome. 

(Dealer Inquiries Welcome) 

TAU LAMBDA 

P.O Box 808, Poulsbo, Washington 98370 
(206) S98-4863 

Apple ][ +■ and AIM are regiiiered trademarks of 
Apple Computer and Rockwell 



Aardvark Technical Sersrices, Ltd 76 

ABM Products 24 

Amplify Inc 62 

Anthro-Digital Software 17 

Apex Co 24 

Appletree Electronics 51 

Ark Computing 12 

Artsci, Inc IPC 

Aurora Software Associates 83 

Bedford Micro Systems 31 

CGRS Microtech. 63 

Cleveland Consuiner Computer Components 80 

Collegiate Microcomputer 67 

Commander 62 

Compu $ense 49 

CompuTech 28 

Computer Mail Order. 56-57 

Computer Science Engineering 89 

Computer Trader '. 99 

Datamost; Inc 34, 90, 92, IBC 

Decision Systems. 67 

Digicom Engineering, Inc 96 

Digital Acoustics 84 

D&N Micro Products, Inc 21 

Eastern House Software 39 

Educational Computing Systems . . . ; 10 

Execom Corp 40 

Gimix, Inc. ..:.... 1 

Gooth Software. 51 

Hayden Software 36 

Hudson Digital Electronics Inc. 68 

Human Systems Dynamic 41 

Interesting Software 95 

Leading Edge , BC 

Logical Devices 99 

Lyco Computer 6 

MICRObits (Classifieds) 53, 86, 87 

MICRO INK 25, 31, 41, 44, 45 

Micro Motion 28 

Micro Signal 50 

Micro-Spec, Ltd. 40 

Micro-Ware Distributing Inc 96 

Midnight Software 49 

MMS, Inc 25 

Modular Systems 83 

Orion Software 18 

Perry Peripherals 73 

Privac, Inc - 2 

Pterodactyl Software. 105 

Quentin Research. .... 29 

SGC ; 4 

SJB Distributing. 64 

Skyles Electric Works. 46, 58 

Softel ; 72 

Software Farm 33 

Software Options i 31 

Southwestern Data Systems 106 

Spectrum Systems. . .'-; 83 

Spies^ Laboratories. 43 

Star Micronics \ 8 

Tau Lambda. Ill 

Unique Data Systems. 102 

Unique Software .. j ...... l 96 

Universal Data Research Ill 

Victory Software 20 

XPS, Inc 101 

MICRO INK is not responsible for claims made by its advertisers. Any 
complaint should be submitted directly to the advertiser. Please also send 
written notification to MICRO. 



No. 55 - December 1982 



MICRO - The 6502/6809 Journal 



111 



Next Month in MICRO 



January: Simulations/Applications/Math 

• Apple Math Editor — This Apple Pascal program 
allows you to construct, edit, and print 
mathematical formulas easily. 

• Sun and Moon — This Applesoft program 
produces a high-resolution graphic simulation of 
the apparent orbits of the sun and moon with 
respect to the Earth. 

• Measurement of a 35mm Focal Plane Shutter — 

The program SHUTTER uses inexpensive 
hardware to measure the accuracy and 
repeatability of a focal plane shutter commonly 
found in 35mm cameras. Although written for the 
Atari 8G0, the program can be modified for any 
computer if you have access to three input pins,a 
ground, and the +5V power supply. 

• Methods to Evaluate Complex Roots — A 

standard procedure to compute complex roots of 
polynomial equation. 



• Discrete Event Simulation on the Apple — An 

expfanatlon of techriiques used in simulating real- 
world situations on a computer. An example 
program involvmg the flow of bank customers is 
presented. 



Department Highlights 

Apple Slices 

PET Vet 

From Here to Atari 

CoCo Bits 

Reviews in Brief 

Software and Hardware Catalogs 

Plus... 

VIC Hi-Res Graphics Explained 
Dealing with Atari's New Languages 
Microcomputer Design of Transistor Amplifiers 
More 680Q0 Instruction Set Tables 



20% OFF 

Your money goes farther when you sub- 
scribe. During the course of a year, when you 
subscribe, you save 20% (in the U.S.). 

Pay only $24.00 ($2.00 a copy) for 12 monthly 
issues of MICRO sent directly to your home or 
office in the U.S. 



More MICRO for Less Money 
When You Subscribe 

But on the newsstand — if you can locate the 
issue you want — you pay $30.00 a year ($2.50 
a copy). 

Special Offer — Subscribe for 2 years ($42.00) 
and get 30% off the single issue price. 

Subscribe to MICRO today. 



MICRO 

34 Chelmsford Street 
P.O. Box 6502 
Chelmsford, MA 01824 

Please send me MICRO for . 



Check enclosed $_ 
Charge my 



Subscription Rates Effective January 1, 1982 



No. 





Country 


Rate 




United States 


$24.00 1 yr. 


. 1 year 2 years 




42.00 2 yr. 


ccepted for 1 year only. 


Foreign surface mail 


27,00 




Europe (air) 


42.00 




Mexico. Central America. Mid East, 




VISA account 


N. & C. Africa 


43.00 


Mastercard account 


South Am.. S. Afr., Far East, 






Australasia, New Zealand 


72.00 



Expiration date . 
Name 



Address 



City/State . 



* Airmail subscriptions accepted for only 1 year. 
For U.S. and Canadian 2-year rates, multiply by 2. 



Job Title: 



-Zip 



Type of Business/Industry 



112 



MICRO - The 6502/6809 Journal 



No. 55 - December 1982 



By the Cardmaster— original Cribbage and 4 Solitaire gameii 



►*^ «fi 




• ■ • • (^ 






• ••••-•i»«'# 



tv 







■*-« 




=^=^=^ The 





«A 




When you're tired, upset, bored ... in need of a chal- 
lenge, or just relief from the ordinary there's nothing to com- 
pare with the fun and involvement of Solitaire or Cribbage. 
Within seconds you've forgotten the world and are absorbed 
in the play of the cards. And the brilliant way the Cardmaster 
programmed these games has tal<en out the effort and dis- 
tractions but left in all the fun and challenge. 



Only $34.95 for the Apple II* at your computer store on 



On a scale of 1 to 10. these card stars rate a big 11! ... for 
sheer enjoyment and unmatched value. Think of it, five of the 
Cardmaster's best games at the price you'd expect to pay for 
just one! It includes original Cribb^lge, with your strategy "^ 
against the Apple . . . plus 4 Solitaire games: Klondike, the alt; ; 
time standard, in 2 versions (1 or 3 cards at a time), exdtiqg j : 
Rcture Frame and the challenging l^ramid! If y0u of yii3i»gS| 
family like cards at all, this is the one disk you muS^Kgetfy: 5||| 



9-:'vv','.''':;'^i:-5^,^;^?li 



^748 CozycroftAve.,Chatsworth.CA 91311 (213) 709-1202. 



VISA, MASTERCARD accepted. $2.00 shipping/hanidlingchaiige. 
(California residents add 6 '/;% sales tax.) 

•Apple II Is a trademark of Apple Computer, Inc. 



THE PR0WRIIER GOMEIR 





(And It Cometh On Like GangbustersJ 

Evolution. 

It's inevitable. An eternal 
verity. 

Just when you think you've 
got it knocked, and you're 
resting on your laurels, some- 
body comes along and makes 
a dinosaur out of you. 

Witness what happened to 
the Centronics printer when 
the Epson MX-80 came along 
in 1981. 

And now, witness what's 
happening to the MX-80 as 
the ProWriter cometh to be 
the foremost printer of the 
decade. 
SPEED 

MX-80: 80 cps, for 46 full lines 
per minute throughput. 
PROWRITER; 120 cps, for 
63 full lines per minute 
throughput. 
GRAPHICS 
MX-80: Block graphics 
standard, fine for things like 
bar graphs. 

PROWRJTER: High-resolu- 
tion graphics features, fine 
for bar graphs, smooth curves, 
thin lines, intricate details, etc. 
PRINTING 

MX-80: Dot matrix business 
quality. 

PROWRITER: Dot matrix 
correspondence quality, with 
incremental printing capability 
standard. 
FEED 

MX-80: Tractor feed standard; 
optional friction-feed kit for 
about $75 extra. 
PROWRITER: Both tractor 
and friction feed standard. 
INTERFACE 
MX-80: Parallel interface 
standard; optional serial 
interface for about $75 extra. 
PROWRITER: Parallel and 
serial interface standard. 
WARRANTY 
MX-80: 90 days, from Epson. 
PROWRITER: One full year, 
from Leading Edge. 
PRICE 
Heh, heh. 

Distributed Exclusively by Leading 
Edge Products. Inc.. 225 Turnpike 
Street, Canton. Massachusetts 
02021. Call: toll-free 1-800-343-6833: 
or in Massachusetts call collect 
1617)828-8150. Telex 951-624. 

LEADING 
EDGE 

For a free poster of "Ace" 
IPro-writer's pilotj doing his thing, 
please write us.